]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/vodlocker.py
be0a2780f5299571ee134ac47e17eda6476673ac
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
5 from ..compat
import compat_urllib_parse
6 from ..utils
import sanitized_Request
9 class VodlockerIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?vodlocker\.com/(?P<id>[0-9a-zA-Z]+)(?:\..*?)?'
13 'url': 'http://vodlocker.com/e8wvyzz4sl42',
14 'md5': 'ce0c2d18fa0735f1bd91b69b0e54aacf',
18 'title': 'Germany vs Brazil',
19 'thumbnail': 're:http://.*\.jpg',
23 def _real_extract(self
, url
):
24 video_id
= self
._match
_id
(url
)
25 webpage
= self
._download
_webpage
(url
, video_id
)
27 fields
= self
._hidden
_inputs
(webpage
)
29 if fields
['op'] == 'download1':
30 self
._sleep
(3, video_id
) # they do detect when requests happen too fast!
31 post
= compat_urllib_parse
.urlencode(fields
)
32 req
= sanitized_Request(url
, post
)
33 req
.add_header('Content-type', 'application/x-www-form-urlencoded')
34 webpage
= self
._download
_webpage
(
35 req
, video_id
, 'Downloading video page')
37 title
= self
._search
_regex
(
38 r
'id="file_title".*?>\s*(.*?)\s*<(?:br|span)', webpage
, 'title')
39 thumbnail
= self
._search
_regex
(
40 r
'image:\s*"(http[^\"]+)",', webpage
, 'thumbnail')
41 url
= self
._search
_regex
(
42 r
'file:\s*"(http[^\"]+)",', webpage
, 'file url')
52 'thumbnail': thumbnail
,