]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/promptfile.py
d5357283addc5e1faafebff51044083eeb4fafa3
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_parse
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
= self
._hidden
_inputs
(webpage
)
37 post
= compat_urllib_parse
.urlencode(fields
)
38 req
= sanitized_Request(url
, post
)
39 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
40 webpage
= self
._download
_webpage
(
41 req
, video_id
, 'Downloading video page')
43 url
= self
._html
_search
_regex
(r
'url:\s*\'([^
\']+)\'', webpage, 'URL
')
44 title = self._html_search_regex(
45 r'<span
.+title
="([^"]+)">', webpage, 'title')
46 thumbnail = self._html_search_regex(
47 r'<div id="player_overlay
">.*button>.*?<img src="([^
"]+)"',
48 webpage, 'thumbnail
', fatal=False, flags=re.DOTALL)
53 'ext
': determine_ext(title),
55 self._sort_formats(formats)
60 'thumbnail
': thumbnail,