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