mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 14:37:43 +01:00
Use proper urlparse functions and simplify a bit
This commit is contained in:
parent
f2e237adc8
commit
f7b567ff84
@ -2165,20 +2165,16 @@ def _real_extract(self, url):
|
|||||||
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
|
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
|
||||||
return
|
return
|
||||||
|
|
||||||
if '/play/' in url:
|
urlp = compat_urllib_parse_urlparse(url)
|
||||||
|
if urlp.path.startswith('/play/'):
|
||||||
request = compat_urllib_request.Request(url)
|
request = compat_urllib_request.Request(url)
|
||||||
response = compat_urllib_request.urlopen(request)
|
response = compat_urllib_request.urlopen(request)
|
||||||
redirecturl = response.geturl()
|
redirecturl = response.geturl()
|
||||||
hashindex = redirecturl.find('#')
|
rurlp = compat_urllib_parse_urlparse(redirecturl)
|
||||||
if hashindex!=-1:
|
file_id = compat_parse_qs(rurlp.fragment)['file'][0].rpartition('/')[2]
|
||||||
hash = redirecturl[hashindex+1:]
|
url = 'http://blip.tv/a/a-' + file_id
|
||||||
params = compat_parse_qs(hash)
|
return self._real_extract(url)
|
||||||
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:
|
if '?' in url:
|
||||||
cchar = '&'
|
cchar = '&'
|
||||||
|
Loading…
Reference in New Issue
Block a user