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.

39 lines
1.3 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. 'info_dict': {
  10. 'id': '255180355939',
  11. 'ext': 'mp4',
  12. 'title': 'Official Trailer: Gotham',
  13. 'description': 'Tracing the rise of the great DC Comics Super-Villains and vigilantes, Gotham reveals an entirely new chapter that has never been told.',
  14. 'duration': 129,
  15. },
  16. 'add_ie': ['ThePlatform'],
  17. 'params': {
  18. # m3u8 download
  19. 'skip_download': True,
  20. },
  21. }
  22. def _real_extract(self, url):
  23. video_id = self._match_id(url)
  24. webpage = self._download_webpage(url, video_id)
  25. release_url = self._parse_json(self._search_regex(
  26. r'"fox_pdk_player"\s*:\s*({[^}]+?})', webpage, 'fox_pdk_player'),
  27. video_id)['release_url'] + '&manifest=m3u'
  28. return {
  29. '_type': 'url_transparent',
  30. 'ie_key': 'ThePlatform',
  31. 'url': smuggle_url(release_url, {'force_smil_url': True}),
  32. 'id': video_id,
  33. }