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.

43 lines
1.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .anvato import AnvatoIE
  4. from ..utils import js_to_json
  5. class FOX9IE(AnvatoIE):
  6. _VALID_URL = r'https?://(?:www\.)?fox9\.com/(?:[^/]+/)+(?P<id>\d+)-story'
  7. _TESTS = [{
  8. 'url': 'http://www.fox9.com/news/215123287-story',
  9. 'md5': 'd6e1b2572c3bab8a849c9103615dd243',
  10. 'info_dict': {
  11. 'id': '314473',
  12. 'ext': 'mp4',
  13. 'title': 'Bear climbs tree in downtown Duluth',
  14. 'description': 'md5:6a36bfb5073a411758a752455408ac90',
  15. 'duration': 51,
  16. 'timestamp': 1478123580,
  17. 'upload_date': '20161102',
  18. 'uploader': 'EPFOX',
  19. 'categories': ['News', 'Sports'],
  20. 'tags': ['news', 'video'],
  21. },
  22. }, {
  23. 'url': 'http://www.fox9.com/news/investigators/214070684-story',
  24. 'only_matching': True,
  25. }]
  26. def _real_extract(self, url):
  27. video_id = self._match_id(url)
  28. webpage = self._download_webpage(url, video_id)
  29. video_id = self._parse_json(
  30. self._search_regex(
  31. r'AnvatoPlaylist\s*\(\s*(\[.+?\])\s*\)\s*;',
  32. webpage, 'anvato playlist'),
  33. video_id, transform_source=js_to_json)[0]['video']
  34. return self._get_anvato_videos(
  35. 'anvato_epfox_app_web_prod_b3373168e12f423f41504f207000188daf88251b',
  36. video_id)