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.

63 lines
2.2 KiB

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