summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2014-09-10 19:13:22 +0700
committerSergey M․ <[email protected]>2014-09-10 19:13:22 +0700
commit6899f2fe9ed2347255f216cfcfc954dd716e5e14 (patch)
tree4eb5dfef2904f0621a2af36693945ea8640e2961 /youtube_dl/extractor
parent136c8bd2757709fa18da3670e34435cb177b0905 (diff)
downloadyoutube-dl-6899f2fe9ed2347255f216cfcfc954dd716e5e14.tar.gz
youtube-dl-6899f2fe9ed2347255f216cfcfc954dd716e5e14.zip
[hostingbulk] Simplify
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/hostingbulk.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/youtube_dl/extractor/hostingbulk.py b/youtube_dl/extractor/hostingbulk.py
index a07dd4962..8e812b669 100644
--- a/youtube_dl/extractor/hostingbulk.py
+++ b/youtube_dl/extractor/hostingbulk.py
@@ -57,17 +57,13 @@ class HostingBulkIE(InfoExtractor):
thumbnail = self._search_regex(
r'<img src="([^"]+)".+?class="pic"',
webpage, 'thumbnail', fatal=False)
- rand = self._search_regex(
- r'<input.+?name="rand" value="([^"]+)">', webpage, 'rand')
- fields = {
- 'id': video_id,
- 'method_free': '',
- 'method_premium': '',
- 'op': 'download2',
- 'rand': rand,
- 'referer': '',
- }
+ fields = dict(re.findall(r'''(?x)<input\s+
+ type="hidden"\s+
+ name="([^"]+)"\s+
+ value="([^"]*)"
+ ''', webpage))
+
request = compat_urllib_request.Request(url, urlencode_postdata(fields))
request.add_header('Content-type', 'application/x-www-form-urlencoded')
response = self._request_webpage(request, video_id,