]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/promptfile.py
f536e6e6cdfb3d71e21c98614e2baf117387493b
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
17 class PromptFileIE(InfoExtractor
):
18 _VALID_URL
= r
'https?://(?:www\.)?promptfile\.com/l/(?P<id>[0-9A-Z\-]+)'
20 'url': 'http://www.promptfile.com/l/D21B4746E9-F01462F0FF',
21 'md5': 'd1451b6302da7215485837aaea882c4c',
23 'id': 'D21B4746E9-F01462F0FF',
26 'thumbnail': 're:^https?://.*\.jpg$',
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, video_id
)
34 if re
.search(r
'<div.+id="not_found_msg".+>(?!We are).+</div>[^-]', webpage
) is not None:
35 raise ExtractorError('Video %s does not exist' % video_id
,
38 fields
= dict(re
.findall(r
'''(?x)type="hidden"\s+
42 post
= compat_urllib_parse
.urlencode(fields
)
43 req
= compat_urllib_request
.Request(url
, post
)
44 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
45 webpage
= self
._download
_webpage
(
46 req
, video_id
, 'Downloading video page')
48 url
= self
._html
_search
_regex
(r
'url:\s*\'([^
\']+)\'', webpage, 'URL
')
49 title = self._html_search_regex(
50 r'<span
.+title
="([^"]+)">', webpage, 'title')
51 thumbnail = self._html_search_regex(
52 r'<div id="player_overlay
">.*button>.*?<img src="([^
"]+)"',
53 webpage, 'thumbnail
', fatal=False, flags=re.DOTALL)
58 'ext
': determine_ext(title),
60 self._sort_formats(formats)
65 'thumbnail
': thumbnail,