Allow downloading http://blip.tv/play/ embeded URLs
[youtube-dl] / youtube_dl / InfoExtractors.py
index d52506389807008353e424341b25c7ef406d9a53..64079d1fd4e13af4c64379f00a72bab426839198 100755 (executable)
@@ -1741,8 +1741,7 @@ class YoutubePlaylistIE(InfoExtractor):
                 break
             page_num += 1
 
-        videos = map(operator.itemgetter(1), sorted(videos))
-
+        videos = [v[1] for v in sorted(videos)]
         total = len(videos)
 
         playliststart = self._downloader.params.get('playliststart', 1) - 1
@@ -2166,6 +2165,21 @@ class BlipTVIE(InfoExtractor):
             self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
             return
 
+        if '/play/' in url:
+            request = compat_urllib_request.Request(url)
+            response = compat_urllib_request.urlopen(request)
+            redirecturl = response.geturl()
+            hashindex = redirecturl.find('#')
+            if hashindex!=-1:
+                hash = redirecturl[hashindex+1:]
+                params = compat_parse_qs(hash)
+                files = params['file']
+                for file in files:
+                    match = re.search('/(\d+)',file)
+                    if match:
+                        file_id = match.group(1)
+                        url = 'http://blip.tv/a/a-'+file_id
+
         if '?' in url:
             cchar = '&'
         else: