]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[generic] add generic support for twitter:player embeds
authorRemita Amine <remitamine@gmail.com>
Thu, 30 Jun 2016 11:01:30 +0000 (12:01 +0100)
committerRemita Amine <remitamine@gmail.com>
Thu, 30 Jun 2016 11:01:30 +0000 (12:01 +0100)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/generic.py
youtube_dl/extractor/theatlantic.py [deleted file]

index d9ffde449fa242ca24f56ce2431b0c171f790805..80d1bbe2075740dff89ddbb748a11c776adcdb38 100644 (file)
@@ -799,7 +799,6 @@ from .teletask import TeleTaskIE
 from .telewebion import TelewebionIE
 from .testurl import TestURLIE
 from .tf1 import TF1IE
-from .theatlantic import TheAtlanticIE
 from .theintercept import TheInterceptIE
 from .theplatform import (
     ThePlatformIE,
index 712dd8a94ce6aad443101d2b7e88facbb2452eb4..c2a7f92025c88e69f405817ebb24836832767930 100644 (file)
@@ -1245,6 +1245,22 @@ class GenericIE(InfoExtractor):
                 'uploader': 'www.hudl.com',
             },
         },
+        # twitter:player embed
+        {
+            'url': 'http://www.theatlantic.com/video/index/484130/what-do-black-holes-sound-like/',
+            'md5': 'a3e0df96369831de324f0778e126653c',
+            'info_dict': {
+                'id': '4909620399001',
+                'ext': 'mp4',
+                'title': 'What Do Black Holes Sound Like?',
+                'description': 'what do black holes sound like',
+                'upload_date': '20160524',
+                'uploader_id': '29913724001',
+                'timestamp': 1464107587,
+                'uploader': 'TheAtlantic',
+            },
+            'add_ie': ['BrightcoveLegacy'],
+        }
     ]
 
     def report_following_redirect(self, new_url):
@@ -2081,6 +2097,11 @@ class GenericIE(InfoExtractor):
                 'uploader': video_uploader,
             }
 
+        # https://dev.twitter.com/cards/types/player#On_twitter.com_via_desktop_browser
+        embed_url = self._twitter_search_player(webpage)
+        if embed_url:
+            return self.url_result(embed_url)
+
         def check_video(vurl):
             if YoutubeIE.suitable(vurl):
                 return True
diff --git a/youtube_dl/extractor/theatlantic.py b/youtube_dl/extractor/theatlantic.py
deleted file mode 100644 (file)
index df4254f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
-from .common import InfoExtractor
-
-
-class TheAtlanticIE(InfoExtractor):
-    _VALID_URL = r'https?://(?:www\.)?theatlantic\.com/video/index/(?P<id>\d+)'
-    _TEST = {
-        'url': 'http://www.theatlantic.com/video/index/477918/capture-a-unified-theory-on-mental-health/',
-        'md5': '',
-        'info_dict': {
-            'id': '477918',
-            'ext': 'mp4',
-            'title': 'Are All Mental Illnesses Related?',
-            'description': 'Depression, anxiety, overeating, addiction, and all other mental disorders share a common mechanism.',
-            'timestamp': 1460490952,
-            'uploader': 'TheAtlantic',
-            'upload_date': '20160412',
-            'uploader_id': '29913724001',
-        },
-        'params': {
-            # m3u8 download
-            'skip_download': True,
-        },
-        'add_ie': ['BrightcoveLegacy'],
-    }
-
-    def _real_extract(self, url):
-        video_id = self._match_id(url)
-        webpage = self._download_webpage(url, video_id)
-        return {
-            '_type': 'url_transparent',
-            'url': self._html_search_meta('twitter:player', webpage),
-            'id': video_id,
-            'title': self._og_search_title(webpage),
-            'description': self._og_search_description(webpage),
-            'thumbnail': self._og_search_thumbnail(webpage),
-            'ie_key': 'BrightcoveLegacy',
-        }