[bloomberg] Fix ooyala url extraction
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Wed, 29 Jan 2014 17:03:32 +0000 (18:03 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Wed, 29 Jan 2014 17:03:32 +0000 (18:03 +0100)
Added a helper method to InfoExtractor for searching the ‘twitter:player’ meta property.
Now the OoyalaIE also recognizes the ‘ec’ parameter in the url as the embed code.

youtube_dl/extractor/bloomberg.py
youtube_dl/extractor/common.py
youtube_dl/extractor/ooyala.py

index d18bc7e0ca5c9d5556d60e354e8b0d9f351e89f7..df2cff81c603b5d85d0f6c82a0f36af509002301 100644 (file)
@@ -24,5 +24,5 @@ class BloombergIE(InfoExtractor):
         mobj = re.match(self._VALID_URL, url)
         name = mobj.group('name')
         webpage = self._download_webpage(url, name)
-        ooyala_code = self._search_regex(r'<source src="http://player.ooyala.com/player/[^/]+/([^".]+)', webpage, u'ooyala url')
-        return OoyalaIE._build_url_result(ooyala_code)
+        ooyala_url = self._twitter_search_player(webpage)
+        return self.url_result(ooyala_url, OoyalaIE.ie_key())
index f7478d4598e8f15ea802ec9451aff53ce452fe7a..70ba9eaba3f1e4cc32207867ba3dc6a4ed0d2b10 100644 (file)
@@ -465,6 +465,10 @@ class InfoExtractor(object):
         }
         return RATING_TABLE.get(rating.lower(), None)
 
+    def _twitter_search_player(self, html):
+        return self._html_search_meta('twitter:player', html,
+            'twitter card player')
+
     def _sort_formats(self, formats):
         if not formats:
             raise ExtractorError(u'No video formats found')
index d08e47734c217864a93062acbe87e2e658c57779..44312ba4ecf61220ad21e8d233a40e99960389b2 100644 (file)
@@ -5,7 +5,7 @@ from .common import InfoExtractor
 from ..utils import unescapeHTML
 
 class OoyalaIE(InfoExtractor):
-    _VALID_URL = r'https?://.+?\.ooyala\.com/.*?embedCode=(?P<id>.+?)(&|$)'
+    _VALID_URL = r'https?://.+?\.ooyala\.com/.*?(?:embedCode|ec)=(?P<id>.+?)(&|$)'
 
     _TEST = {
         # From http://it.slashdot.org/story/13/04/25/178216/recovering-data-from-broken-hard-drives-and-ssds-video