]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/streamcloud.py
5 from .common
import InfoExtractor
12 class StreamcloudIE(InfoExtractor
):
13 IE_NAME
= u
'streamcloud.eu'
14 _VALID_URL
= r
'https?://streamcloud\.eu/(?P<id>[a-zA-Z0-9_-]+)/(?P<fname>[^#?]*)\.html'
17 u
'url': u
'http://streamcloud.eu/skp9j99s4bpz/youtube-dl_test_video_____________-BaW_jenozKc.mp4.html',
18 u
'file': u
'skp9j99s4bpz.mp4',
19 u
'md5': u
'6bea4c7fa5daaacc2a946b7146286686',
21 u
'title': u
'youtube-dl test video \'/\\ ä ↭',
24 u
'skip': u
'Only available from the EU'
27 def _real_extract(self
, url
):
28 mobj
= re
.match(self
._VALID
_URL
, url
)
29 video_id
= mobj
.group('id')
31 orig_webpage
= self
._download
_webpage
(url
, video_id
)
33 fields
= re
.findall(r
'''(?x)<input\s+
34 type="(?:hidden|submit)"\s+
39 post
= compat_urllib_parse
.urlencode(fields
)
41 self
.to_screen('%s: Waiting for timeout' % 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
=u
'Downloading video page ...')
50 title
= self
._html
_search
_regex
(
51 r
'<h1[^>]*>([^<]+)<', webpage
, u
'title')
52 video_url
= self
._search
_regex
(
53 r
'file:\s*"([^"]+)"', webpage
, u
'video URL')
54 duration_str
= self
._search
_regex
(
55 r
'duration:\s*"?([0-9]+)"?', webpage
, u
'duration', fatal
=False)
56 duration
= None if duration_str
is None else int(duration_str
)
57 thumbnail
= self
._search
_regex
(
58 r
'image:\s*"([^"]+)"', webpage
, u
'thumbnail URL', fatal
=False)
65 'thumbnail': thumbnail
,