From 96b7c7fe3fb099c1c6be1d80ee5b291045e8db77 Mon Sep 17 00:00:00 2001 From: Yuriy Melnyk Date: Sat, 29 Nov 2014 17:58:34 +0200 Subject: [PATCH 1/2] [bliptv] Fix resolution of lookup id in some videos In some videos (for example, http://blip.tv/play/gbk766dkj4Yn) resolving lookup id would fail, because page at http://blip.tv/play/gbk766dkj4Yn.x?p=1 would have no "config.id" in it. Fixed by requesting different URL and inspecting the URL which the client is redirected to. --- youtube_dl/extractor/bliptv.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/bliptv.py b/youtube_dl/extractor/bliptv.py index f2b02643d..a18c64dc0 100644 --- a/youtube_dl/extractor/bliptv.py +++ b/youtube_dl/extractor/bliptv.py @@ -64,6 +64,20 @@ class BlipTVIE(SubtitlesInfoExtractor): 'uploader': 'redvsblue', 'uploader_id': '792887', } + }, + { + 'url': 'http://blip.tv/play/gbk766dkj4Yn', + 'md5': 'fe0a33f022d49399a241e84a8ea8b8e3', + 'info_dict': { + 'id': '1749452', + 'ext': 'mp4', + 'upload_date': '20090208', + 'description': 'Witness the first appearance of the Nostalgia Critic character, as Doug reviews the movie Transformers.', + 'title': 'Nostalgia Critic: Transformers', + 'timestamp': 1234068723, + 'uploader': 'NostalgiaCritic', + 'uploader_id': '246467', + } } ] @@ -74,11 +88,13 @@ class BlipTVIE(SubtitlesInfoExtractor): # See https://github.com/rg3/youtube-dl/issues/857 and # https://github.com/rg3/youtube-dl/issues/4197 if lookup_id: - info_page = self._download_webpage( - 'http://blip.tv/play/%s.x?p=1' % lookup_id, lookup_id, 'Resolving lookup id') - video_id = self._search_regex(r'config\.id\s*=\s*"([0-9]+)', info_page, 'video_id') - else: - video_id = mobj.group('id') + urlh = self._request_webpage( + 'http://blip.tv/play/%s' % lookup_id, lookup_id, 'Resolving lookup id') + url = compat_urlparse.urlparse(urlh.geturl()) + qs = compat_urlparse.parse_qs(url.query) + mobj = re.match(self._VALID_URL, qs['file'][0]) + + video_id = mobj.group('id') rss = self._download_xml('http://blip.tv/rss/flash/%s' % video_id, video_id, 'Downloading video RSS') From 248a0b890f1e1a122079cbe855599e5fcec080e8 Mon Sep 17 00:00:00 2001 From: Yuriy Melnyk Date: Sat, 29 Nov 2014 18:14:57 +0200 Subject: [PATCH 2/2] [bliptv] Fix \n\n at the end of real_url See https://github.com/rg3/youtube-dl/issues/3544#issuecomment-53166516 --- youtube_dl/extractor/bliptv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl/extractor/bliptv.py b/youtube_dl/extractor/bliptv.py index a18c64dc0..da47f27bd 100644 --- a/youtube_dl/extractor/bliptv.py +++ b/youtube_dl/extractor/bliptv.py @@ -130,7 +130,7 @@ class BlipTVIE(SubtitlesInfoExtractor): msg = self._download_webpage( url + '?showplayer=20140425131715&referrer=http://blip.tv&mask=7&skin=flashvars&view=url', video_id, 'Resolving URL for %s' % role) - real_url = compat_urlparse.parse_qs(msg)['message'][0] + real_url = compat_urlparse.parse_qs(msg.strip())['message'][0] media_type = media_content.get('type') if media_type == 'text/srt' or url.endswith('.srt'):