Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

upload_video infinite loop with check progress #549

Open
jvazquez opened this issue Jan 27, 2023 · 0 comments
Open

upload_video infinite loop with check progress #549

jvazquez opened this issue Jan 27, 2023 · 0 comments

Comments

@jvazquez
Copy link

jvazquez commented Jan 27, 2023

Hey there, I noticed a particular behavior when uploading the attached video, I'm consuming v1.1 standard

When https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L174 is called with check_progress = True

The file uploads correctly.

https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L235 starts, because check_progress = True

https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L246 is "pending"

The code ends up looping in https://github.com/ryanmcgrath/twython/blob/master/twython/endpoints.py#L251, because
response changes from

{'media_id': 1618986262236372992, 'media_id_string': '1618986262236372992', 'media_key': '7_1618986262236372992', 'size': 902118, 'expires_after_secs': 86400, 'processing_info': {'state': 'pending', 'check_after_secs': 1}}

to

{'media_id': 1618986262236372992, 'media_id_string': '1618986262236372992', 'media_key': '7_1618986262236372992', 'size': 902118, 'processing_info': {'state': 'in_progress', 'progress_percent': 100, 'error': {'code': 1, 'name': 'InvalidMedia', 'message': 'file is invalid'}}}

So you end up in an infinite loop.

I ran the video through ffmpeg and initially it seems to be ok according to https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/uploading-media/media-best-practices

I attempted the code without doing check progress and it fails with Twitter API returned a 400 (Bad Request), Not valid video

I know this bug report seems way too specific, but perhaps that particular behavior should change under these circumstances ?.

I know it's terribly specific and it may not happen to anyone and perhaps this should be closed, but just in case the same thing happens to someone else.

pizza.mp4
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant