mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-04 23:35:04 +00:00
[hostingbulk] Simplify
This commit is contained in:
parent
136c8bd275
commit
6899f2fe9e
1 changed files with 6 additions and 10 deletions
|
@ -57,17 +57,13 @@ def _real_extract(self, url):
|
||||||
thumbnail = self._search_regex(
|
thumbnail = self._search_regex(
|
||||||
r'<img src="([^"]+)".+?class="pic"',
|
r'<img src="([^"]+)".+?class="pic"',
|
||||||
webpage, 'thumbnail', fatal=False)
|
webpage, 'thumbnail', fatal=False)
|
||||||
rand = self._search_regex(
|
|
||||||
r'<input.+?name="rand" value="([^"]+)">', webpage, 'rand')
|
|
||||||
|
|
||||||
fields = {
|
fields = dict(re.findall(r'''(?x)<input\s+
|
||||||
'id': video_id,
|
type="hidden"\s+
|
||||||
'method_free': '',
|
name="([^"]+)"\s+
|
||||||
'method_premium': '',
|
value="([^"]*)"
|
||||||
'op': 'download2',
|
''', webpage))
|
||||||
'rand': rand,
|
|
||||||
'referer': '',
|
|
||||||
}
|
|
||||||
request = compat_urllib_request.Request(url, urlencode_postdata(fields))
|
request = compat_urllib_request.Request(url, urlencode_postdata(fields))
|
||||||
request.add_header('Content-type', 'application/x-www-form-urlencoded')
|
request.add_header('Content-type', 'application/x-www-form-urlencoded')
|
||||||
response = self._request_webpage(request, video_id,
|
response = self._request_webpage(request, video_id,
|
||||||
|
|
Loading…
Reference in a new issue