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