diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2013-03-03 22:09:44 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2013-03-03 22:09:44 +0100 |
commit | f7b567ff84b4be37099d7907157829f8642074dd (patch) | |
tree | 5076d68e592d62be92ee5b7756d5f0b75c6fa14f | |
parent | f2e237adc8493fbd186cdc4a92cedfa0801a7faf (diff) |
Use proper urlparse functions and simplify a bit
-rwxr-xr-x | youtube_dl/InfoExtractors.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index d19efe93f..4b6a1c097 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -2165,20 +2165,16 @@ class BlipTVIE(InfoExtractor): self._downloader.trouble(u'ERROR: invalid URL: %s' % url) return - if '/play/' in url: + urlp = compat_urllib_parse_urlparse(url) + if urlp.path.startswith('/play/'): 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 + 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) + if '?' in url: cchar = '&' |