]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/promptfile.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
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/86D1CE8462-576CAAE416',
19 'md5': '5a7e285a26e0d66d9a263fae91bc92ce',
21 'id': '86D1CE8462-576CAAE416',
23 'title': 'oceans.mp4',
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 chash_pattern
= r
'\$\("#chash"\)\.val\("(.+)"\+\$\("#chash"\)'
37 chash
= self
._html
_search
_regex
(chash_pattern
, webpage
, "chash")
38 fields
= self
._hidden
_inputs
(webpage
)
40 fields
[k
] = chash
+ fields
[k
]
42 post
= urlencode_postdata(fields
)
43 req
= sanitized_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_pattern
= r
'<a href="(http://www\.promptfile\.com/file/[^"]+)'
49 url
= self
._html
_search
_regex
(url_pattern
, webpage
, 'URL')
50 title
= self
._html
_search
_regex
(
51 r
'<span.+title="([^"]+)">', webpage
, 'title')
52 thumbnail
= self
._html
_search
_regex
(
53 r
'<div id="player_overlay">.*button>.*?<img src="([^"]+)"',
54 webpage
, 'thumbnail', fatal
=False, flags
=re
.DOTALL
)
59 'ext': determine_ext(title
),
61 self
._sort
_formats
(formats
)
66 'thumbnail': thumbnail
,