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.

66 lines
2.3 KiB

9 years ago
9 years ago
  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import smuggle_url
  4. class AENetworksIE(InfoExtractor):
  5. IE_NAME = 'aenetworks'
  6. IE_DESC = 'A+E Networks: A&E, Lifetime, History.com, FYI Network'
  7. _VALID_URL = r'https?://(?:www\.)?(?:(?:history|aetv|mylifetime)\.com|fyi\.tv)/(?:[^/]+/)+(?P<id>[^/]+?)(?:$|[?#])'
  8. _TESTS = [{
  9. 'url': 'http://www.history.com/topics/valentines-day/history-of-valentines-day/videos/bet-you-didnt-know-valentines-day?m=528e394da93ae&s=undefined&f=1&free=false',
  10. 'info_dict': {
  11. 'id': 'g12m5Gyt3fdR',
  12. 'ext': 'mp4',
  13. 'title': "Bet You Didn't Know: Valentine's Day",
  14. 'description': 'md5:7b57ea4829b391995b405fa60bd7b5f7',
  15. },
  16. 'params': {
  17. # m3u8 download
  18. 'skip_download': True,
  19. },
  20. 'add_ie': ['ThePlatform'],
  21. 'expected_warnings': ['JSON-LD'],
  22. }, {
  23. 'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1',
  24. 'info_dict': {
  25. 'id': 'eg47EERs_JsZ',
  26. 'ext': 'mp4',
  27. 'title': "Winter Is Coming",
  28. 'description': 'md5:641f424b7a19d8e24f26dea22cf59d74',
  29. },
  30. 'params': {
  31. # m3u8 download
  32. 'skip_download': True,
  33. },
  34. 'add_ie': ['ThePlatform'],
  35. }, {
  36. 'url': 'http://www.aetv.com/shows/duck-dynasty/video/inlawful-entry',
  37. 'only_matching': True
  38. }, {
  39. 'url': 'http://www.fyi.tv/shows/tiny-house-nation/videos/207-sq-ft-minnesota-prairie-cottage',
  40. 'only_matching': True
  41. }, {
  42. 'url': 'http://www.mylifetime.com/shows/project-runway-junior/video/season-1/episode-6/superstar-clients',
  43. 'only_matching': True
  44. }]
  45. def _real_extract(self, url):
  46. video_id = self._match_id(url)
  47. webpage = self._download_webpage(url, video_id)
  48. video_url_re = [
  49. r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id,
  50. r"media_url\s*=\s*'([^']+)'"
  51. ]
  52. video_url = self._search_regex(video_url_re, webpage, 'video url')
  53. info = self._search_json_ld(webpage, video_id, fatal=False)
  54. info.update({
  55. '_type': 'url_transparent',
  56. 'url': smuggle_url(video_url, {'sig': {'key': 'crazyjava', 'secret': 's3cr3t'}}),
  57. })
  58. return info