]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/played.py
645a1e06dc8f3678b30d4e41b38ea13396c7a3e0
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
10 compat_urllib_request
,
14 class PlayedIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?:www\.)?played\.to/(?P<id>[a-zA-Z0-9_-]+)'
19 'url': 'http://played.to/j2f2sfiiukgt',
20 'md5': 'c2bd75a368e82980e7257bf500c00637',
24 'title': 'youtube-dl_test_video.mp4',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
31 orig_webpage
= self
._download
_webpage
(url
, video_id
)
33 r
'type="hidden" name="([^"]+)"\s+value="([^"]+)">', orig_webpage
)
36 self
._sleep
(2, video_id
)
38 post
= compat_urllib_parse
.urlencode(data
)
40 b
'Content-Type': b
'application/x-www-form-urlencoded',
42 req
= compat_urllib_request
.Request(url
, post
, headers
)
43 webpage
= self
._download
_webpage
(
44 req
, video_id
, note
='Downloading video page ...')
46 title
= os
.path
.splitext(data
['fname'])[0]
48 video_url
= self
._search
_regex
(
49 r
'file: "?(.+?)",', webpage
, 'video URL')