2 from __future__ import unicode_literals
8 from .common import InfoExtractor
11 compat_urllib_request,
15 class PlayedIE(InfoExtractor):
17 _VALID_URL = r'https?://played\.to/(?P<id>[a-zA-Z0-9_-]+)'
20 'url': 'http://played.to/j2f2sfiiukgt',
21 'md5': 'c2bd75a368e82980e7257bf500c00637',
25 'title': 'youtube-dl_test_video.mp4',
29 def _real_extract(self, url):
30 mobj = re.match(self._VALID_URL, url)
31 video_id = mobj.group('id')
33 orig_webpage = self._download_webpage(url, video_id)
34 fields = re.findall(r'type="hidden" name="(.+?)"\s* value="?(.+?)">', orig_webpage)
37 self.to_screen('%s: Waiting for timeout' % video_id)
40 post = compat_urllib_parse.urlencode(data)
42 b'Content-Type': b'application/x-www-form-urlencoded',
44 req = compat_urllib_request.Request(url, post, headers)
45 webpage = self._download_webpage(
46 req, video_id, note='Downloading video page ...')
48 title = os.path.splitext(data['fname'])[0]
50 video_url = self._search_regex(
51 r'file: "?(.+?)",', webpage, 'video URL')