From 04244171592ffe3a7ce2950c0c0c7c8af0b874ef Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Fri, 15 Feb 2019 07:15:41 -0800 Subject: [PATCH] twitter: update max video upload size from 5MB to 512MB fixes #162 --- README.md | 2 ++ granary/tests/test_twitter.py | 4 ++-- granary/twitter.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 16bbd143..5fcc4870 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,8 @@ Changelog * Instagram: * Fix individual photo/video link urls for multi-photo/video posts. * Handle [user-provided alt text](https://instagram-press.com/blog/2018/11/28/creating-a-more-accessible-instagram/) ([#159](https://github.com/snarfed/granary/issues/159)). +* Twitter: + * Update max video upload size from 5MB to 512MB ([#162](https://github.com/snarfed/granary/issues/162). * `/url`: Return HTTP 400 when fetching the user's URL results in an infinite redirect. ### 1.14 - 2018-11-12 diff --git a/granary/tests/test_twitter.py b/granary/tests/test_twitter.py index 0b00c8d7..eaf8bc42 100644 --- a/granary/tests/test_twitter.py +++ b/granary/tests/test_twitter.py @@ -2575,8 +2575,8 @@ def test_create_with_video_too_big(self): 'stream': {'url': 'http://my/video'}, }) self.assertTrue(ret.abort) - self.assertIn("larger than Twitter's 15MB limit.", ret.error_plain) - self.assertIn("larger than Twitter's 15MB limit.", ret.error_html) + self.assertIn("larger than Twitter's 512MB limit.", ret.error_plain) + self.assertIn("larger than Twitter's 512MB limit.", ret.error_html) def test_create_with_video_wrong_type(self): self.expect_urlopen('http://my/video', '', diff --git a/granary/twitter.py b/granary/twitter.py index e0c03d31..ff4c8447 100644 --- a/granary/twitter.py +++ b/granary/twitter.py @@ -97,7 +97,8 @@ 'image/gif', 'image/webp',)) VIDEO_MIME_TYPES = frozenset(('video/mp4',)) MB = 1024 * 1024 -MAX_VIDEO_SIZE = 15 * MB +# https://developer.twitter.com/en/docs/media/upload-media/uploading-media/media-best-practices +MAX_VIDEO_SIZE = 512 * MB UPLOAD_CHUNK_SIZE = 5 * MB MAX_ALT_LENGTH = 420