diff options
author | Yen Chi Hsuan <[email protected]> | 2016-06-08 21:12:14 +0800 |
---|---|---|
committer | Yen Chi Hsuan <[email protected]> | 2016-06-08 21:12:14 +0800 |
commit | fc0a45fa416ad3e3ecf5936061efbb0328afa6b5 (patch) | |
tree | 4b393e3ed06219c72152e5010a98a846d31dbcec /youtube_dl/extractor/twitter.py | |
parent | e6e90515db983ca447cf7a59bbc153907d4fff4a (diff) | |
download | youtube-dl-fc0a45fa416ad3e3ecf5936061efbb0328afa6b5.tar.gz youtube-dl-fc0a45fa416ad3e3ecf5936061efbb0328afa6b5.zip |
[twitter] Detect suspended accounts and update _TESTS
Diffstat (limited to 'youtube_dl/extractor/twitter.py')
-rw-r--r-- | youtube_dl/extractor/twitter.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/extractor/twitter.py b/youtube_dl/extractor/twitter.py index ea673054f..129103c64 100644 --- a/youtube_dl/extractor/twitter.py +++ b/youtube_dl/extractor/twitter.py @@ -207,6 +207,7 @@ class TwitterIE(InfoExtractor): 'uploader_id': 'giphz', }, 'expected_warnings': ['height', 'width'], + 'skip': 'Account suspended', }, { 'url': 'https://twitter.com/starwars/status/665052190608723968', 'md5': '39b7199856dee6cd4432e72c74bc69d4', @@ -278,7 +279,11 @@ class TwitterIE(InfoExtractor): user_id = mobj.group('user_id') twid = mobj.group('id') - webpage = self._download_webpage(self._TEMPLATE_URL % (user_id, twid), twid) + webpage, urlh = self._download_webpage_handle( + self._TEMPLATE_URL % (user_id, twid), twid) + + if 'twitter.com/account/suspended' in urlh.geturl(): + raise ExtractorError('Account suspended by Twitter.', expected=True) username = remove_end(self._og_search_title(webpage), ' on Twitter') |