aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor
diff options
context:
space:
mode:
authorOndřej Bárta <git@ondrej.it>2016-09-25 12:44:46 +0200
committerSergey M․ <dstftw@gmail.com>2016-09-26 23:20:58 +0700
commitd3dbb46330461c0c70c3aae47b69d27882cfc325 (patch)
tree7cde04091b80fae36452f5c9b546b27385c7333b /youtube_dl/extractor
parentfffb9cff944cfab11f311900ee8138f28f7232d3 (diff)
[promptfile] Fix extraction (Closes #10634)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r--youtube_dl/extractor/promptfile.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/youtube_dl/extractor/promptfile.py b/youtube_dl/extractor/promptfile.py
index f93bd19ff..54c4aee13 100644
--- a/youtube_dl/extractor/promptfile.py
+++ b/youtube_dl/extractor/promptfile.py
@@ -15,12 +15,12 @@ from ..utils import (
class PromptFileIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?promptfile\.com/l/(?P<id>[0-9A-Z\-]+)'
_TEST = {
- 'url': 'http://www.promptfile.com/l/D21B4746E9-F01462F0FF',
- 'md5': 'd1451b6302da7215485837aaea882c4c',
+ 'url': 'http://www.promptfile.com/l/86D1CE8462-576CAAE416',
+ 'md5': '5a7e285a26e0d66d9a263fae91bc92ce',
'info_dict': {
- 'id': 'D21B4746E9-F01462F0FF',
+ 'id': '86D1CE8462-576CAAE416',
'ext': 'mp4',
- 'title': 'Birds.mp4',
+ 'title': 'oceans.mp4',
'thumbnail': 're:^https?://.*\.jpg$',
}
}
@@ -33,14 +33,20 @@ class PromptFileIE(InfoExtractor):
raise ExtractorError('Video %s does not exist' % video_id,
expected=True)
+ chash_pattern = r'\$\("#chash"\)\.val\("(.+)"\+\$\("#chash"\)'
+ chash = self._html_search_regex(chash_pattern, webpage, "chash")
fields = self._hidden_inputs(webpage)
+ k = list(fields)[0]
+ fields[k] = chash + fields[k]
+
post = urlencode_postdata(fields)
req = sanitized_Request(url, post)
req.add_header('Content-type', 'application/x-www-form-urlencoded')
webpage = self._download_webpage(
req, video_id, 'Downloading video page')
- url = self._html_search_regex(r'url:\s*\'([^\']+)\'', webpage, 'URL')
+ url_pattern = r'<a href="(http://www\.promptfile\.com/file/[^"]+)'
+ url = self._html_search_regex(url_pattern, webpage, 'URL')
title = self._html_search_regex(
r'<span.+title="([^"]+)">', webpage, 'title')
thumbnail = self._html_search_regex(