]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/streamcloud.py
77841b94686a27feb00968e5f3b67729504cee6c
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_parse
8 from ..utils
import sanitized_Request
11 class StreamcloudIE(InfoExtractor
):
12 IE_NAME
= 'streamcloud.eu'
13 _VALID_URL
= r
'https?://streamcloud\.eu/(?P<id>[a-zA-Z0-9_-]+)(?:/(?P<fname>[^#?]*)\.html)?'
16 'url': 'http://streamcloud.eu/skp9j99s4bpz/youtube-dl_test_video_____________-BaW_jenozKc.mp4.html',
17 'md5': '6bea4c7fa5daaacc2a946b7146286686',
21 'title': 'youtube-dl test video \'/\\ ä ↭',
23 'skip': 'Only available from the EU'
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
28 url
= 'http://streamcloud.eu/%s' % video_id
30 orig_webpage
= self
._download
_webpage
(url
, video_id
)
32 fields
= re
.findall(r
'''(?x)<input\s+
33 type="(?:hidden|submit)"\s+
38 post
= compat_urllib_parse
.urlencode(fields
)
40 self
._sleep
(12, video_id
)
42 b
'Content-Type': b
'application/x-www-form-urlencoded',
44 req
= sanitized_Request(url
, post
, headers
)
46 webpage
= self
._download
_webpage
(
47 req
, video_id
, note
='Downloading video page ...')
48 title
= self
._html
_search
_regex
(
49 r
'<h1[^>]*>([^<]+)<', webpage
, 'title')
50 video_url
= self
._search
_regex
(
51 r
'file:\s*"([^"]+)"', webpage
, 'video URL')
52 thumbnail
= self
._search
_regex
(
53 r
'image:\s*"([^"]+)"', webpage
, 'thumbnail URL', fatal
=False)
59 'thumbnail': thumbnail
,