2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class VodlockerIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:www\.)?vodlocker\.(?:com|city)/(?:embed-)?(?P<id>[0-9a-zA-Z]+)(?:\..*?)?'
17 'url': 'http://vodlocker.com/e8wvyzz4sl42',
18 'md5': 'ce0c2d18fa0735f1bd91b69b0e54aacf',
22 'title': 'Germany vs Brazil',
23 'thumbnail': r
're:http://.*\.jpg',
27 def _real_extract(self
, url
):
28 video_id
= self
._match
_id
(url
)
29 webpage
= self
._download
_webpage
(url
, video_id
)
31 if any(p
in webpage
for p
in (
32 '>THIS FILE WAS DELETED<',
34 'The file you were looking for could not be found, sorry for any inconvenience.<',
35 '>The file was removed')):
36 raise ExtractorError('Video %s does not exist' % video_id
, expected
=True)
38 fields
= self
._hidden
_inputs
(webpage
)
40 if fields
['op'] == 'download1':
41 self
._sleep
(3, video_id
) # they do detect when requests happen too fast!
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 def extract_file_url(html
, default
=NO_DEFAULT
):
49 return self
._search
_regex
(
50 r
'file:\s*"(http[^\"]+)",', html
, 'file url', default
=default
)
52 video_url
= extract_file_url(webpage
, default
=None)
55 embed_url
= self
._search
_regex
(
56 r
'<iframe[^>]+src=(["\'])(?P
<url
>(?
:https?
://)?vodlocker\
.(?
:com|city
)/embed
-.+?
)\
1',
57 webpage, 'embed url
', group='url
')
58 embed_webpage = self._download_webpage(
59 embed_url, video_id, 'Downloading embed webpage
')
60 video_url = extract_file_url(embed_webpage)
61 thumbnail_webpage = embed_webpage
63 thumbnail_webpage = webpage
65 title = self._search_regex(
66 r'id="file_title".*?
>\s
*(.*?
)\s
*<(?
:br|span
)', webpage, 'title
')
67 thumbnail = self._search_regex(
68 r'image
:\s
*"(http[^\"]+)",', thumbnail_webpage, 'thumbnail
', fatal=False)
78 'thumbnail
': thumbnail,