Commit | Line | Data |
---|---|---|
97f85f28 | 1 | # Large Video Upload |
2 | ||
03695c65 | 3 | This Python sample demonstrates the following process of uploading large video files asynchronously with the Twitter API. |
97f85f28 | 4 | |
5 | 1. **INIT** media upload. | |
6 | 2. **APPEND** chunked data. | |
7 | 3. **FINALIZE** media uploaded. | |
8 | 4. Check **STATUS** of video processing. | |
03695c65 | 9 | 5. Tweet with attached video. |
97f85f28 | 10 | |
03695c65 | 11 | 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. |
97f85f28 | 12 | |
03695c65 | 13 | [Learn more](https://dev.twitter.com/rest/media) about the Twitter Media APIs. Pay attention to the other requirements such as encoding, frame size and video formats supported. |
97f85f28 | 14 | |
15 | ## Running the sample | |
16 | ||
17 | 1. Install requirements: | |
18 | ||
19 | ``` | |
03695c65 | 20 | $ pip install -r requirements.txt |
97f85f28 | 21 | ``` |
22 | ||
03695c65 | 23 | 2. Fill in your [consumer keys and access tokens](https://apps.twitter.com) in `async-upload.py`: |
97f85f28 | 24 | |
25 | ``` | |
26 | CONSUMER_KEY = 'your-consumer-key' | |
27 | CONSUMER_SECRET = 'your-consumer-secret' | |
28 | ACCESS_TOKEN = 'your-access-token' | |
29 | ACCESS_TOKEN_SECRET = 'your-access-secret' | |
30 | ``` | |
31 | ||
03695c65 AP |
32 | 3. Edit path to your video file in `async-upload.py`: |
33 | ||
34 | ``` | |
35 | VIDEO_FILENAME = 'path/to/video/file' | |
36 | ``` | |
37 | ||
38 | 4. Run script: | |
97f85f28 | 39 | |
40 | ``` | |
41 | $ python async-upload.py | |
03695c65 AP |
42 | ``` |
43 | ||
44 | Questions? Check our [developer discussion forums](https://https://twittercommunity.com/c/media-apis). |