]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/gamekings.py
[vimeo] Fix password protected videos again (#5082)
[yt-dlp.git] / youtube_dl / extractor / gamekings.py
CommitLineData
d87ec897 1# coding: utf-8
806d6c2e
JMF
2from __future__ import unicode_literals
3
eb9b5bff 4from .common import InfoExtractor
955c5505 5from ..utils import (
6 xpath_text,
d87ec897
S
7 xpath_with_ns,
8)
955c5505 9
eb9b5bff
JW
10
11class GamekingsIE(InfoExtractor):
41c23b0d 12 _VALID_URL = r'http://www\.gamekings\.tv/(?:videos|nieuws)/(?P<id>[^/]+)'
d87ec897 13 _TESTS = [{
806d6c2e 14 'url': 'http://www.gamekings.tv/videos/phoenix-wright-ace-attorney-dual-destinies-review/',
eab27241 15 # MD5 is flaky, seems to change regularly
806d6c2e 16 # 'md5': '2f32b1f7b80fdc5cb616efb4f387f8a3',
8865bdeb 17 'info_dict': {
d87ec897 18 'id': 'phoenix-wright-ace-attorney-dual-destinies-review',
806d6c2e
JMF
19 'ext': 'mp4',
20 'title': 'Phoenix Wright: Ace Attorney \u2013 Dual Destinies Review',
eec4d8ef 21 'description': 'md5:36fd701e57e8c15ac8682a2374c99731',
d87ec897 22 'thumbnail': 're:^https?://.*\.jpg$',
ba322d82 23 },
d87ec897
S
24 }, {
25 # vimeo video
ba322d82 26 'url': 'http://www.gamekings.tv/videos/the-legend-of-zelda-majoras-mask/',
d87ec897 27 'md5': '12bf04dfd238e70058046937657ea68d',
ba322d82 28 'info_dict': {
d87ec897 29 'id': 'the-legend-of-zelda-majoras-mask',
ba322d82 30 'ext': 'mp4',
8ca8cbe2 31 'title': 'The Legend of Zelda: Majora’s Mask',
d87ec897
S
32 'description': 'md5:9917825fe0e9f4057601fe1e38860de3',
33 'thumbnail': 're:^https?://.*\.jpg$',
34 },
41c23b0d
S
35 }, {
36 'url': 'http://www.gamekings.tv/nieuws/gamekings-extra-shelly-en-david-bereiden-zich-voor-op-de-livestream/',
37 'only_matching': True,
d87ec897 38 }]
eb9b5bff
JW
39
40 def _real_extract(self, url):
d87ec897
S
41 video_id = self._match_id(url)
42
43 webpage = self._download_webpage(url, video_id)
eb9b5bff 44
d87ec897
S
45 playlist_id = self._search_regex(
46 r'gogoVideo\(\s*\d+\s*,\s*"([^"]+)', webpage, 'playlist id')
5d678df6 47
d87ec897
S
48 playlist = self._download_xml(
49 'http://www.gamekings.tv/wp-content/themes/gk2010/rss_playlist.php?id=%s' % playlist_id,
50 video_id)
5d678df6 51
955c5505 52 NS_MAP = {
53 'jwplayer': 'http://rss.jwpcdn.com/'
d87ec897
S
54 }
55
56 item = playlist.find('./channel/item')
5d678df6 57
d87ec897
S
58 thumbnail = xpath_text(item, xpath_with_ns('./jwplayer:image', NS_MAP), 'thumbnail')
59 video_url = item.find(xpath_with_ns('./jwplayer:source', NS_MAP)).get('file')
eb9b5bff 60
384b98cd
PH
61 return {
62 'id': video_id,
384b98cd
PH
63 'url': video_url,
64 'title': self._og_search_title(webpage),
65 'description': self._og_search_description(webpage),
d87ec897 66 'thumbnail': thumbnail,
384b98cd 67 }