]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vodlocker.py
6d3b78749eaf1b25d23422343ab36c9d84c7cdc0
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class VodlockerIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?vodlocker\.com/(?P<id>[0-9a-zA-Z]+)(?:\..*?)?'
16 'url': 'http://vodlocker.com/e8wvyzz4sl42',
17 'md5': 'ce0c2d18fa0735f1bd91b69b0e54aacf',
21 'title': 'Germany vs Brazil',
22 'thumbnail': 're:http://.*\.jpg',
26 def _real_extract(self
, url
):
27 mobj
= re
.match(self
._VALID
_URL
, url
)
28 video_id
= mobj
.group('id')
29 webpage
= self
._download
_webpage
(url
, video_id
)
31 fields
= dict(re
.findall(r
'''(?x)<input\s+
38 if fields
['op'] == 'download1':
39 self
._sleep
(3, video_id
) # they do detect when requests happen too fast!
40 post
= compat_urllib_parse
.urlencode(fields
)
41 req
= compat_urllib_request
.Request(url
, post
)
42 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
43 webpage
= self
._download
_webpage
(
44 req
, video_id
, 'Downloading video page')
46 title
= self
._search
_regex
(
47 r
'id="file_title".*?>\s*(.*?)\s*<span', webpage
, 'title')
48 thumbnail
= self
._search
_regex
(
49 r
'image:\s*"(http[^\"]+)",', webpage
, 'thumbnail')
50 url
= self
._search
_regex
(
51 r
'file:\s*"(http[^\"]+)",', webpage
, 'file url')
61 'thumbnail': thumbnail
,