ae.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. 'expected_warnings': ['JSON-LD'],
  20. }, {
  21. 'url': 'http://www.history.com/shows/mountain-men/season-1/episode-1',
  22. 'info_dict': {
  23. 'id': 'eg47EERs_JsZ',
  24. 'ext': 'mp4',
  25. 'title': "Winter Is Coming",
  26. 'description': 'md5:641f424b7a19d8e24f26dea22cf59d74',
  27. },
  28. 'params': {
  29. # m3u8 download
  30. 'skip_download': True,
  31. },
  32. 'add_ie': ['ThePlatform'],
  33. }, {
  34. 'url': 'http://www.aetv.com/shows/duck-dynasty/video/inlawful-entry',
  35. 'only_matching': True
  36. }, {
  37. 'url': 'http://www.fyi.tv/shows/tiny-house-nation/videos/207-sq-ft-minnesota-prairie-cottage',
  38. 'only_matching': True
  39. }, {
  40. 'url': 'http://www.mylifetime.com/shows/project-runway-junior/video/season-1/episode-6/superstar-clients',
  41. 'only_matching': True
  42. }]
  43. def _real_extract(self, url):
  44. video_id = self._match_id(url)
  45. webpage = self._download_webpage(url, video_id)
  46. video_url_re = [
  47. r'data-href="[^"]*/%s"[^>]+data-release-url="([^"]+)"' % video_id,
  48. r"media_url\s*=\s*'([^']+)'"
  49. ]
  50. video_url = self._search_regex(video_url_re, webpage, 'video url')
  51. info = self._search_json_ld(webpage, video_id, fatal=False)
  52. info.update({
  53. '_type': 'url_transparent',
  54. 'url': smuggle_url(video_url, {'sig': {'key': 'crazyjava', 'secret': 's3cr3t'}}),
  55. })
  56. return info