]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[twitter] Detect suspended accounts and update _TESTS
authorYen Chi Hsuan <yan12125@gmail.com>
Wed, 8 Jun 2016 13:12:14 +0000 (21:12 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Wed, 8 Jun 2016 13:12:14 +0000 (21:12 +0800)
youtube_dl/extractor/twitter.py

index ea673054fdc7135a203cca8db00dc128344b0829..129103c645372d45ccfb15917b30beaccc518185 100644 (file)
@@ -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')