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.

57 lines
2.1 KiB

  1. from __future__ import unicode_literals
  2. from .mtv import MTVServicesInfoExtractor
  3. class BellatorIE(MTVServicesInfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?bellator\.com/[^/]+/[\da-z]{6}(?:[/?#&]|$)'
  5. _TESTS = [{
  6. 'url': 'http://www.bellator.com/fight/atwr7k/bellator-158-michael-page-vs-evangelista-cyborg',
  7. 'info_dict': {
  8. 'id': 'b55e434e-fde1-4a98-b7cc-92003a034de4',
  9. 'ext': 'mp4',
  10. 'title': 'Douglas Lima vs. Paul Daley - Round 1',
  11. 'description': 'md5:805a8dd29310fd611d32baba2f767885',
  12. },
  13. 'params': {
  14. # m3u8 download
  15. 'skip_download': True,
  16. },
  17. }, {
  18. 'url': 'http://www.bellator.com/video-clips/bw6k7n/bellator-158-foundations-michael-venom-page',
  19. 'only_matching': True,
  20. }]
  21. _FEED_URL = 'http://www.spike.com/feeds/mrss/'
  22. _GEO_COUNTRIES = ['US']
  23. class ParamountNetworkIE(MTVServicesInfoExtractor):
  24. _VALID_URL = r'https?://(?:www\.)?paramountnetwork\.com/[^/]+/[\da-z]{6}(?:[/?#&]|$)'
  25. _TESTS = [{
  26. 'url': 'http://www.paramountnetwork.com/episodes/j830qm/lip-sync-battle-joel-mchale-vs-jim-rash-season-2-ep-13',
  27. 'info_dict': {
  28. 'id': '37ace3a8-1df6-48be-85b8-38df8229e241',
  29. 'ext': 'mp4',
  30. 'title': 'Lip Sync Battle|April 28, 2016|2|209|Joel McHale Vs. Jim Rash|Act 1',
  31. 'description': 'md5:a739ca8f978a7802f67f8016d27ce114',
  32. },
  33. 'params': {
  34. # m3u8 download
  35. 'skip_download': True,
  36. },
  37. }]
  38. _FEED_URL = 'http://www.paramountnetwork.com/feeds/mrss/'
  39. _GEO_COUNTRIES = ['US']
  40. def _extract_mgid(self, webpage):
  41. root_data = self._parse_json(self._search_regex(
  42. r'window\.__DATA__\s*=\s*({.+})',
  43. webpage, 'data'), None)
  44. def find_sub_data(data, data_type):
  45. return next(c for c in data['children'] if c.get('type') == data_type)
  46. c = find_sub_data(find_sub_data(root_data, 'MainContainer'), 'VideoPlayer')
  47. return c['props']['media']['video']['config']['uri']