]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/gamekings.py
Merge branch 'ustream-embed-recorded2' of https://github.com/anovicecodemonkey/youtub...
[youtube-dl] / youtube_dl / extractor / gamekings.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6
7
8 class GamekingsIE(InfoExtractor):
9     _VALID_URL = r'http://www\.gamekings\.tv/videos/(?P<name>[0-9a-z\-]+)'
10     _TEST = {
11         'url': 'http://www.gamekings.tv/videos/phoenix-wright-ace-attorney-dual-destinies-review/',
12         # MD5 is flaky, seems to change regularly
13         # 'md5': '2f32b1f7b80fdc5cb616efb4f387f8a3',
14         u'info_dict': {
15             'id': '20130811',
16             'ext': 'mp4',
17             'title': 'Phoenix Wright: Ace Attorney \u2013 Dual Destinies Review',
18             'description': 'md5:36fd701e57e8c15ac8682a2374c99731',
19         }
20     }
21
22     def _real_extract(self, url):
23
24         mobj = re.match(self._VALID_URL, url)
25         name = mobj.group('name')
26         webpage = self._download_webpage(url, name)
27         video_url = self._og_search_video_url(webpage)
28
29         video = re.search(r'[0-9]+', video_url)
30         video_id = video.group(0)
31
32         # Todo: add medium format
33         video_url = video_url.replace(video_id, 'large/' + video_id)
34
35         return {
36             'id': video_id,
37             'ext': 'mp4',
38             'url': video_url,
39             'title': self._og_search_title(webpage),
40             'description': self._og_search_description(webpage),
41         }