Large Video Upload
This Python sample demonstrates the following process of uploading large video files asynchronously with the Twitter API.
- INIT media upload.
- APPEND chunked data.
- FINALIZE media uploaded.
- Check STATUS of video processing.
- Tweet with attached video.
Large video files are longer than 30 seconds up to 140 seconds, and/or a file size larger than 15 megabytes up to 512 megabytes.
Learn more about the Twitter Media APIs. Pay attention to the other requirements such as encoding, frame size and video formats supported.
Running the sample
$ pip install -r requirements.txt
Fill in your consumer keys and access tokens in
CONSUMER_KEY = 'your-consumer-key' CONSUMER_SECRET = 'your-consumer-secret' ACCESS_TOKEN = 'your-access-token' ACCESS_TOKEN_SECRET = 'your-access-secret'
Edit path to your video file in
VIDEO_FILENAME = 'path/to/video/file'
$ python async-upload.py
Questions? Check our developer discussion forums.