bear / python-twitter

A Python wrapper around the Twitter API.
Apache License 2.0
3.41k stars 955 forks source link

Add support for subtitle endpoints #643

Closed danielthepope closed 4 years ago

danielthepope commented 4 years ago

It's possible to use the Twitter API to upload SRT subtitles and attach them to an already-uploaded video.

The guide to upload and attach subtitles is part of the API documentation for media/subtitles/create. The guide suggests uploading an SRT file through the chunked media upload endpoint. After a quick look it looks like twitter_utils.parse_media_file returns None for the media_type if you try a file that has an .srt extension.

There also needs to be helper functions implemented for media/subtitles/create and media/subtitles/delete

I'm happy to implement this myself. I have a working proof of concept for /create and I've made some changes to the parse_media_file function that will make UploadMediaChunked happy with uploading SRT files.