Merge remote-tracking branch 'rzhxeo/blip'
authorPhilipp Hagemeister <phihag@phihag.de>
Sun, 5 Jan 2014 02:48:45 +0000 (03:48 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Sun, 5 Jan 2014 02:48:45 +0000 (03:48 +0100)
Conflicts:
youtube_dl/extractor/bliptv.py

1  2 
youtube_dl/extractor/bliptv.py
youtube_dl/extractor/generic.py

index 159ea39d9a788bc90304907f75f523a156cebce1,8a8c2e7a88583ec49bc87000712aa3cd8d5fed1a..4f1272f29aa122e309f35c0c9ece72f8278429c7
@@@ -22,17 -20,18 +22,17 @@@ from ..utils import 
  class BlipTVIE(InfoExtractor):
      """Information extractor for blip.tv"""
  
-     _VALID_URL = r'^(?:https?://)?(?:www\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(.+)$'
-     IE_NAME = 'blip.tv'
+     _VALID_URL = r'^(?:https?://)?(?:\w+\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(.+)$'
 -    _URL_EXT = r'^.*\.([a-z0-9]+)$'
 -    IE_NAME = u'blip.tv'
++
      _TEST = {
 -        u'url': u'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352',
 -        u'file': u'5779306.m4v',
 -        u'md5': u'80baf1ec5c3d2019037c1c707d676b9f',
 -        u'info_dict': {
 -            u"upload_date": u"20111205", 
 -            u"description": u"md5:9bc31f227219cde65e47eeec8d2dc596", 
 -            u"uploader": u"Comic Book Resources - CBR TV", 
 -            u"title": u"CBR EXCLUSIVE: \"Gotham City Imposters\" Bats VS Jokerz Short 3"
 +        'url': 'http://blip.tv/cbr/cbr-exclusive-gotham-city-imposters-bats-vs-jokerz-short-3-5796352',
 +        'file': '5779306.mov',
 +        'md5': 'c6934ad0b6acf2bd920720ec888eb812',
 +        'info_dict': {
 +            'upload_date': '20111205',
 +            'description': 'md5:9bc31f227219cde65e47eeec8d2dc596',
 +            'uploader': 'Comic Book Resources - CBR TV',
 +            'title': 'CBR EXCLUSIVE: "Gotham City Imposters" Bats VS Jokerz Short 3',
          }
      }
  
      def _real_extract(self, url):
          mobj = re.match(self._VALID_URL, url)
          if mobj is None:
 -            raise ExtractorError(u'Invalid URL: %s' % url)
 +            raise ExtractorError('Invalid URL: %s' % url)
  
          # See https://github.com/rg3/youtube-dl/issues/857
-         api_mobj = re.match(r'http://a\.blip\.tv/api\.swf#(?P<video_id>[\d\w]+)', url)
-         if api_mobj is not None:
-             url = 'http://blip.tv/play/g_%s' % api_mobj.group('video_id')
-         urlp = compat_urllib_parse_urlparse(url)
-         if urlp.path.startswith('/play/'):
-             response = self._request_webpage(url, None, False)
-             redirecturl = response.geturl()
-             rurlp = compat_urllib_parse_urlparse(redirecturl)
-             file_id = compat_parse_qs(rurlp.fragment)['file'][0].rpartition('/')[2]
-             url = 'http://blip.tv/a/a-' + file_id
-             return self._real_extract(url)
+         embed_mobj = re.search(r'^(?:https?://)?(?:\w+\.)?blip\.tv/(?:play/|api\.swf#)([a-zA-Z0-9]+)', url)
+         if embed_mobj:
+             info_url = 'http://blip.tv/play/%s.x?p=1' % embed_mobj.group(1)
+             info_page = self._download_webpage(info_url, embed_mobj.group(1))
 -            video_id = self._search_regex(r'data-episode-id="(\d+)', info_page, u'video_id')
 -            return self.url_result('http://blip.tv/a/a-'+video_id, 'BlipTV')
++            video_id = self._search_regex(r'data-episode-id="(\d+)', info_page,  'video_id')
++            return self.url_result('http://blip.tv/a/a-' + video_id, 'BlipTV')
  
          if '?' in url:
              cchar = '&'
Simple merge