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. '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. 'timestamp': 1400020798,
  17. 'upload_date': '20140513',
  18. 'uploader': 'NEWA-FNG-FOXCOM',
  19. },
  20. 'add_ie': ['ThePlatform'],
  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'] + '&switch=http'
  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. }