]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/gamekings.py
Add support for https for all extractors as preventive and future-proof measure
[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)
0e1b1a01 9from .youtube import YoutubeIE
955c5505 10
eb9b5bff
JW
11
12class GamekingsIE(InfoExtractor):
5886b38d 13 _VALID_URL = r'https?://www\.gamekings\.nl/(?:videos|nieuws)/(?P<id>[^/]+)'
d87ec897 14 _TESTS = [{
eab3c289 15 # YouTube embed video
14823dec 16 'url': 'http://www.gamekings.nl/videos/phoenix-wright-ace-attorney-dual-destinies-review/',
163da6a4 17 'md5': '5208d3a17adeaef829a7861887cb9029',
8865bdeb 18 'info_dict': {
ce5879fa 19 'id': 'HkSQKetlGOU',
806d6c2e 20 'ext': 'mp4',
ce5879fa 21 'title': 'Phoenix Wright: Ace Attorney - Dual Destinies Review',
22 'description': 'md5:db88c0e7f47e9ea50df3271b9dc72e1d',
d87ec897 23 'thumbnail': 're:^https?://.*\.jpg$',
ce5879fa 24 'uploader_id': 'UCJugRGo4STYMeFr5RoOShtQ',
25 'uploader': 'Gamekings Vault',
26 'upload_date': '20151123',
ba322d82 27 },
eab3c289 28 'add_ie': ['Youtube'],
d87ec897
S
29 }, {
30 # vimeo video
14823dec 31 'url': 'http://www.gamekings.nl/videos/the-legend-of-zelda-majoras-mask/',
d87ec897 32 'md5': '12bf04dfd238e70058046937657ea68d',
ba322d82 33 'info_dict': {
d87ec897 34 'id': 'the-legend-of-zelda-majoras-mask',
ba322d82 35 'ext': 'mp4',
8ca8cbe2 36 'title': 'The Legend of Zelda: Majora’s Mask',
d87ec897
S
37 'description': 'md5:9917825fe0e9f4057601fe1e38860de3',
38 'thumbnail': 're:^https?://.*\.jpg$',
39 },
41c23b0d 40 }, {
14823dec 41 'url': 'http://www.gamekings.nl/nieuws/gamekings-extra-shelly-en-david-bereiden-zich-voor-op-de-livestream/',
41c23b0d 42 'only_matching': True,
d87ec897 43 }]
eb9b5bff
JW
44
45 def _real_extract(self, url):
d87ec897
S
46 video_id = self._match_id(url)
47
48 webpage = self._download_webpage(url, video_id)
eb9b5bff 49
d87ec897 50 playlist_id = self._search_regex(
0e1b1a01 51 r'gogoVideo\([^,]+,\s*"([^"]+)', webpage, 'playlist id')
ce5879fa 52
53 # Check if a YouTube embed is used
0e1b1a01 54 if YoutubeIE.suitable(playlist_id):
ce5879fa 55 return self.url_result(playlist_id, ie='Youtube')
5d678df6 56
d87ec897
S
57 playlist = self._download_xml(
58 'http://www.gamekings.tv/wp-content/themes/gk2010/rss_playlist.php?id=%s' % playlist_id,
59 video_id)
5d678df6 60
955c5505 61 NS_MAP = {
62 'jwplayer': 'http://rss.jwpcdn.com/'
d87ec897
S
63 }
64
65 item = playlist.find('./channel/item')
5d678df6 66
d87ec897
S
67 thumbnail = xpath_text(item, xpath_with_ns('./jwplayer:image', NS_MAP), 'thumbnail')
68 video_url = item.find(xpath_with_ns('./jwplayer:source', NS_MAP)).get('file')
eb9b5bff 69
384b98cd
PH
70 return {
71 'id': video_id,
384b98cd
PH
72 'url': video_url,
73 'title': self._og_search_title(webpage),
74 'description': self._og_search_description(webpage),
d87ec897 75 'thumbnail': thumbnail,
384b98cd 76 }