]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/firedrive.py
3191116d96a0df0e61081fbc85e5745c815f1f99
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
16 class FiredriveIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?firedrive\.com/' + \
18 '(?:file|embed)/(?P<id>[0-9a-zA-Z]+)'
19 _FILE_DELETED_REGEX
= r
'<div class="removed_file_image">'
22 'url': 'https://www.firedrive.com/file/FEB892FA160EBD01',
23 'md5': 'd5d4252f80ebeab4dc2d5ceaed1b7970',
25 'id': 'FEB892FA160EBD01',
27 'title': 'bbb_theora_486kbit.flv',
28 'thumbnail': 're:^http://.*\.jpg$',
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
34 url
= 'http://firedrive.com/file/%s' % video_id
35 webpage
= self
._download
_webpage
(url
, video_id
)
37 if re
.search(self
._FILE
_DELETED
_REGEX
, webpage
) is not None:
38 raise ExtractorError('Video %s does not exist' % video_id
,
41 fields
= dict(re
.findall(r
'''(?x)<input\s+
47 post
= compat_urllib_parse
.urlencode(fields
)
48 req
= compat_urllib_request
.Request(url
, post
)
49 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
51 # Apparently, this header is required for confirmation to work.
52 req
.add_header('Host', 'www.firedrive.com')
54 webpage
= self
._download
_webpage
(req
, video_id
,
55 'Downloading video page')
57 title
= self
._search
_regex
(r
'class="external_title_left">(.+)</div>',
59 thumbnail
= self
._search
_regex
(r
'image:\s?"(//[^\"]+)', webpage
,
60 'thumbnail', fatal
=False)
61 if thumbnail
is not None:
62 thumbnail
= 'http:' + thumbnail
64 ext
= self
._search
_regex
(r
'type:\s?\'([^
\']+)\',',
65 webpage, 'extension
', fatal=False)
66 video_url = self._search_regex(
67 r'file:\s?loadURL\
(\'(http
[^
\']+)\'\
),', webpage, 'file url
')
78 'thumbnail
': thumbnail,