]>
Commit | Line | Data |
---|---|---|
806d6c2e JMF |
1 | from __future__ import unicode_literals |
2 | ||
eb9b5bff JW |
3 | import re |
4 | ||
5 | from .common import InfoExtractor | |
eb9b5bff JW |
6 | |
7 | ||
8 | class GamekingsIE(InfoExtractor): | |
c0ade33e | 9 | _VALID_URL = r'http://www\.gamekings\.tv/videos/(?P<name>[0-9a-z\-]+)' |
ba322d82 | 10 | _TESTS = [ |
11 | { | |
806d6c2e | 12 | 'url': 'http://www.gamekings.tv/videos/phoenix-wright-ace-attorney-dual-destinies-review/', |
eab27241 | 13 | # MD5 is flaky, seems to change regularly |
806d6c2e | 14 | # 'md5': '2f32b1f7b80fdc5cb616efb4f387f8a3', |
8865bdeb | 15 | 'info_dict': { |
806d6c2e JMF |
16 | 'id': '20130811', |
17 | 'ext': 'mp4', | |
18 | 'title': 'Phoenix Wright: Ace Attorney \u2013 Dual Destinies Review', | |
eec4d8ef | 19 | 'description': 'md5:36fd701e57e8c15ac8682a2374c99731', |
ba322d82 | 20 | } |
21 | }, | |
22 | { | |
23 | 'url': 'http://www.gamekings.tv/videos/the-legend-of-zelda-majoras-mask/', | |
24 | 'info_dict': { | |
25 | 'id': '118933752', | |
26 | 'ext': 'mp4', | |
8ca8cbe2 | 27 | 'title': 'The Legend of Zelda: Majora’s Mask', |
28 | 'description': 'md5:9917825fe0e9f4057601fe1e38860de3' | |
ba322d82 | 29 | } |
eb9b5bff | 30 | } |
ba322d82 | 31 | ] |
eb9b5bff JW |
32 | |
33 | def _real_extract(self, url): | |
34 | ||
35 | mobj = re.match(self._VALID_URL, url) | |
36 | name = mobj.group('name') | |
37 | webpage = self._download_webpage(url, name) | |
384b98cd | 38 | video_url = self._og_search_video_url(webpage) |
eb9b5bff | 39 | |
384b98cd | 40 | video = re.search(r'[0-9]+', video_url) |
eb9b5bff JW |
41 | video_id = video.group(0) |
42 | ||
384b98cd PH |
43 | # Todo: add medium format |
44 | video_url = video_url.replace(video_id, 'large/' + video_id) | |
8ca8cbe2 | 45 | if "vimeo" in video_url: |
2f38289b | 46 | video_url = video_url.replace('large/' + video_id, video_id) |
ba322d82 | 47 | video_url = video_url.replace('http://stream.gamekings.tv/', '') |
eb9b5bff | 48 | |
384b98cd PH |
49 | return { |
50 | 'id': video_id, | |
51 | 'ext': 'mp4', | |
52 | 'url': video_url, | |
53 | 'title': self._og_search_title(webpage), | |
54 | 'description': self._og_search_description(webpage), | |
55 | } |