2 from __future__ import unicode_literals
6 from .common import InfoExtractor
11 compat_urllib_request,
15 class PromptFileIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:www\.)?promptfile\.com/l/(?P<id>[0-9A-Z\-]+)'
18 'url': 'http://www.promptfile.com/l/D21B4746E9-F01462F0FF',
19 'md5': 'd1451b6302da7215485837aaea882c4c',
21 'id': 'D21B4746E9-F01462F0FF',
24 'thumbnail': 're:^https?://.*\.jpg$',
28 def _real_extract(self, url):
29 video_id = self._match_id(url)
30 webpage = self._download_webpage(url, video_id)
32 if re.search(r'<div.+id="not_found_msg".+>(?!We are).+</div>[^-]', webpage) is not None:
33 raise ExtractorError('Video %s does not exist' % video_id,
36 fields = dict(re.findall(r'''(?x)type="hidden"\s+
40 post = compat_urllib_parse.urlencode(fields)
41 req = compat_urllib_request.Request(url, post)
42 req.add_header('Content-type', 'application/x-www-form-urlencoded')
43 webpage = self._download_webpage(
44 req, video_id, 'Downloading video page')
46 url = self._html_search_regex(r'url:\s*\'([^\']+)\'', webpage, 'URL')
47 title = self._html_search_regex(
48 r'<span.+title="([^"]+)">', webpage, 'title')
49 thumbnail = self._html_search_regex(
50 r'<div id="player_overlay">.*button>.*?<img src="([^"]+)"',
51 webpage, 'thumbnail', fatal=False, flags=re.DOTALL)
56 'ext': determine_ext(title),
58 self._sort_formats(formats)
63 'thumbnail': thumbnail,