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.

36 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import smuggle_url
  5. class FOXIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?fox\.com/watch/(?P<id>[0-9]+)'
  7. _TEST = {
  8. 'url': 'http://www.fox.com/watch/255180355939/7684182528',
  9. 'md5': 'ebd296fcc41dd4b19f8115d8461a3165',
  10. 'info_dict': {
  11. 'id': '255180355939',
  12. 'ext': 'mp4',
  13. 'title': 'Official Trailer: Gotham',
  14. 'description': 'Tracing the rise of the great DC Comics Super-Villains and vigilantes, Gotham reveals an entirely new chapter that has never been told.',
  15. 'duration': 129,
  16. },
  17. 'add_ie': ['ThePlatform'],
  18. }
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(url, video_id)
  22. release_url = self._parse_json(self._search_regex(
  23. r'"fox_pdk_player"\s*:\s*({[^}]+?})', webpage, 'fox_pdk_player'),
  24. video_id)['release_url'] + '&switch=http'
  25. return {
  26. '_type': 'url_transparent',
  27. 'ie_key': 'ThePlatform',
  28. 'url': smuggle_url(release_url, {'force_smil_url': True}),
  29. 'id': video_id,
  30. }