]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/played.py
57c875ef05dd74a429ea55313b0d956ef7e5ec56
2 from __future__
import unicode_literals
7 from .common
import InfoExtractor
15 class PlayedIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?played\.to/(?P<id>[a-zA-Z0-9_-]+)'
20 'url': 'http://played.to/j2f2sfiiukgt',
21 'md5': 'c2bd75a368e82980e7257bf500c00637',
25 'title': 'youtube-dl_test_video.mp4',
27 'skip': 'Removed for copyright infringement.', # oh wow
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
32 orig_webpage
= self
._download
_webpage
(url
, video_id
)
35 r
'(?s)Reason for deletion:.*?<b class="err"[^>]*>(?P<msg>[^<]+)</b>', orig_webpage
)
37 raise ExtractorError(m_error
.group('msg'), expected
=True)
39 data
= self
._hidden
_inputs
(orig_webpage
)
41 self
._sleep
(2, video_id
)
43 post
= urlencode_postdata(data
)
45 b
'Content-Type': b
'application/x-www-form-urlencoded',
47 req
= sanitized_Request(url
, post
, headers
)
48 webpage
= self
._download
_webpage
(
49 req
, video_id
, note
='Downloading video page ...')
51 title
= os
.path
.splitext(data
['fname'])[0]
53 video_url
= self
._search
_regex
(
54 r
'file: "?(.+?)",', webpage
, 'video URL')