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.

60 lines
2.1 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .amp import AMPIE
  4. class FoxNewsIE(AMPIE):
  5. IE_DESC = 'Fox News and Fox Business Video'
  6. _VALID_URL = r'https?://(?P<host>video\.fox(?:news|business)\.com)/v/(?:video-embed\.html\?video_id=)?(?P<id>\d+)'
  7. _TESTS = [
  8. {
  9. 'url': 'http://video.foxnews.com/v/3937480/frozen-in-time/#sp=show-clips',
  10. 'md5': '32aaded6ba3ef0d1c04e238d01031e5e',
  11. 'info_dict': {
  12. 'id': '3937480',
  13. 'ext': 'flv',
  14. 'title': 'Frozen in Time',
  15. 'description': '16-year-old girl is size of toddler',
  16. 'duration': 265,
  17. 'timestamp': 1304411491,
  18. 'upload_date': '20110503',
  19. 'thumbnail': 're:^https?://.*\.jpg$',
  20. },
  21. },
  22. {
  23. 'url': 'http://video.foxnews.com/v/3922535568001/rep-luis-gutierrez-on-if-obamas-immigration-plan-is-legal/#sp=show-clips',
  24. 'md5': '5846c64a1ea05ec78175421b8323e2df',
  25. 'info_dict': {
  26. 'id': '3922535568001',
  27. 'ext': 'mp4',
  28. 'title': "Rep. Luis Gutierrez on if Obama's immigration plan is legal",
  29. 'description': "Congressman discusses president's plan",
  30. 'duration': 292,
  31. 'timestamp': 1417662047,
  32. 'upload_date': '20141204',
  33. 'thumbnail': 're:^https?://.*\.jpg$',
  34. },
  35. 'params': {
  36. # m3u8 download
  37. 'skip_download': True,
  38. },
  39. },
  40. {
  41. 'url': 'http://video.foxnews.com/v/video-embed.html?video_id=3937480&d=video.foxnews.com',
  42. 'only_matching': True,
  43. },
  44. {
  45. 'url': 'http://video.foxbusiness.com/v/4442309889001',
  46. 'only_matching': True,
  47. },
  48. ]
  49. def _real_extract(self, url):
  50. host, video_id = re.match(self._VALID_URL, url).groups()
  51. info = self._extract_feed_info(
  52. 'http://%s/v/feed/video/%s.js?template=fox' % (host, video_id))
  53. info['id'] = video_id
  54. return info