1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..utils import xpath_text
8 class GamekingsIE(InfoExtractor):
9 _VALID_URL = r'http://www\.gamekings\.tv/videos/(?P<name>[0-9a-z\-]+)'
12 'url': 'http://www.gamekings.tv/videos/phoenix-wright-ace-attorney-dual-destinies-review/',
13 # MD5 is flaky, seems to change regularly
14 # 'md5': '2f32b1f7b80fdc5cb616efb4f387f8a3',
18 'title': 'Phoenix Wright: Ace Attorney \u2013 Dual Destinies Review',
19 'description': 'md5:36fd701e57e8c15ac8682a2374c99731',
23 'url': 'http://www.gamekings.tv/videos/the-legend-of-zelda-majoras-mask/',
27 'title': 'The Legend of Zelda: Majora’s Mask',
28 'description': 'md5:9917825fe0e9f4057601fe1e38860de3'
33 def _real_extract(self, url):
35 mobj = re.match(self._VALID_URL, url)
36 name = mobj.group('name')
37 webpage = self._download_webpage(url, name)
39 playlist_id = re.search(r'(?:gogoVideo)\(\d+,"?(?P<playlist_id>.*)"', webpage, re.MULTILINE).group('playlist_id')
40 playlist_url = 'http://www.gamekings.tv/wp-content/themes/gk2010/rss_playlist.php?id=' + playlist_id
41 playlist_rss = self._download_xml(playlist_url, playlist_id)
44 'rss': 'http://rss.jwpcdn.com/'
47 # Todo: Implement Xpath for searching the video link
49 video_url = self._og_search_video_url(webpage)
51 video = re.search(r'[0-9]+', video_url)
52 video_id = video.group(0)
54 # Todo: add medium format
55 video_url = video_url.replace(video_id, 'large/' + video_id)
56 if "vimeo" in video_url:
57 video_url = video_url.replace('large/' + video_id, video_id)
58 video_url = video_url.replace('http://stream.gamekings.tv/', '')
64 'title': self._og_search_title(webpage),
65 'description': self._og_search_description(webpage),