ustreamIE
authorJaime Marquínez Ferrándiz <jaimemf93@gmail.com>
Tue, 1 Jan 2013 16:52:46 +0000 (17:52 +0100)
committerJaime Marquínez Ferrándiz <jaimemf93@gmail.com>
Tue, 1 Jan 2013 17:14:20 +0000 (18:14 +0100)
test/tests.json
youtube_dl/InfoExtractors.py
youtube_dl/__init__.py

index 7c39866255e90a984cea36783d5ba3a5a679fdb9..784e09fb385009e9059d217c633e9cda5031da30 100644 (file)
     "info_dict": {
         "title": "Terraria 1.1 Trailer"
     }
+  },
+  {
+    "name": "Ustream",
+    "url": "http://www.ustream.tv/recorded/20274954",
+    "files": [["20274954.flv", "088f151799e8f572f84eb62f17d73e5c" ]],
+    "info_dict": {
+        "title": "Young Americans for Liberty February 7, 2012 2:28 AM"
+    }
   }
 ]
index d7295ae3fe0bafb87dd3a1ea88e431ffd31cd32f..3dad82835e1af48caa367cfa06ab8038e5f34678 100755 (executable)
@@ -3805,3 +3805,32 @@ class SteamIE(InfoExtractor):
                   }
             videos.append(info)
         return videos
+        
+class UstreamIE(InfoExtractor):
+    _VALID_URL = r'http://www.ustream.tv/recorded/(?P<videoID>\d+)'
+    IE_NAME = u'ustream'
+    
+    def _real_extract(self, url):
+        m = re.match(self._VALID_URL, url)
+        video_id = m.group('videoID')
+        video_url = u'http://tcdn.ustream.tv/video/%s' % video_id
+        try:
+            urlh = compat_urllib_request.urlopen(url)
+            webpage_bytes = urlh.read()
+            webpage = webpage_bytes.decode('utf-8', 'ignore')
+        except (compat_urllib_error.URLError, compat_http_client.HTTPException, socket.error) as err:
+            self._downloader.trouble(u'ERROR: unable to download webpage: %s' % compat_str(err))
+            return
+        m = re.search(r'data-title="(?P<title>.+)"',webpage)
+        title = m.group('title')
+        m = re.search(r'<a class="state" data-content-type="channel" data-content-id="(?P<uploader>\d+)"',webpage)
+        uploader = m.group('uploader')
+        info = {
+                'id':video_id,
+                'url':video_url,
+                'ext': 'flv',
+                'title': title,
+                'uploader': uploader
+                  }
+        return [info]
+    pass
index 62ecdf6b6c97b766ed320488bcdf208307102be1..faaeab04b5ccc008af2295022407dc4a0bcc4392 100644 (file)
@@ -314,6 +314,7 @@ def gen_extractors():
         FunnyOrDieIE(),
         TweetReelIE(),
         SteamIE(),
+        UstreamIE(),
         GenericIE()
     ]