You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.3 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. xpath_text,
  6. xpath_with_ns,
  7. )
  8. class GamekingsIE(InfoExtractor):
  9. _VALID_URL = r'http://www\.gamekings\.tv/(?:videos|nieuws)/(?P<id>[^/]+)'
  10. _TESTS = [{
  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. 'info_dict': {
  15. 'id': 'phoenix-wright-ace-attorney-dual-destinies-review',
  16. 'ext': 'mp4',
  17. 'title': 'Phoenix Wright: Ace Attorney \u2013 Dual Destinies Review',
  18. 'description': 'md5:36fd701e57e8c15ac8682a2374c99731',
  19. 'thumbnail': 're:^https?://.*\.jpg$',
  20. },
  21. }, {
  22. # vimeo video
  23. 'url': 'http://www.gamekings.tv/videos/the-legend-of-zelda-majoras-mask/',
  24. 'md5': '12bf04dfd238e70058046937657ea68d',
  25. 'info_dict': {
  26. 'id': 'the-legend-of-zelda-majoras-mask',
  27. 'ext': 'mp4',
  28. 'title': 'The Legend of Zelda: Majora’s Mask',
  29. 'description': 'md5:9917825fe0e9f4057601fe1e38860de3',
  30. 'thumbnail': 're:^https?://.*\.jpg$',
  31. },
  32. }, {
  33. 'url': 'http://www.gamekings.tv/nieuws/gamekings-extra-shelly-en-david-bereiden-zich-voor-op-de-livestream/',
  34. 'only_matching': True,
  35. }]
  36. def _real_extract(self, url):
  37. video_id = self._match_id(url)
  38. webpage = self._download_webpage(url, video_id)
  39. playlist_id = self._search_regex(
  40. r'gogoVideo\(\s*\d+\s*,\s*"([^"]+)', webpage, 'playlist id')
  41. playlist = self._download_xml(
  42. 'http://www.gamekings.tv/wp-content/themes/gk2010/rss_playlist.php?id=%s' % playlist_id,
  43. video_id)
  44. NS_MAP = {
  45. 'jwplayer': 'http://rss.jwpcdn.com/'
  46. }
  47. item = playlist.find('./channel/item')
  48. thumbnail = xpath_text(item, xpath_with_ns('./jwplayer:image', NS_MAP), 'thumbnail')
  49. video_url = item.find(xpath_with_ns('./jwplayer:source', NS_MAP)).get('file')
  50. return {
  51. 'id': video_id,
  52. 'url': video_url,
  53. 'title': self._og_search_title(webpage),
  54. 'description': self._og_search_description(webpage),
  55. 'thumbnail': thumbnail,
  56. }