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.

40 lines
1.5 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. class ThisAmericanLifeIE(InfoExtractor):
  4. _VALID_URL = r'https?://(?:www\.)?thisamericanlife\.org/(?:radio-archives/episode/|play_full\.php\?play=)(?P<id>\d+)'
  5. _TESTS = [{
  6. 'url': 'http://www.thisamericanlife.org/radio-archives/episode/487/harper-high-school-part-one',
  7. 'md5': '8f7d2da8926298fdfca2ee37764c11ce',
  8. 'info_dict': {
  9. 'id': '487',
  10. 'ext': 'm4a',
  11. 'title': '487: Harper High School, Part One',
  12. 'description': 'md5:ee40bdf3fb96174a9027f76dbecea655',
  13. 'thumbnail': 're:^https?://.*\.jpg$',
  14. },
  15. }, {
  16. 'url': 'http://www.thisamericanlife.org/play_full.php?play=487',
  17. 'only_matching': True,
  18. }]
  19. def _real_extract(self, url):
  20. video_id = self._match_id(url)
  21. webpage = self._download_webpage(
  22. 'http://www.thisamericanlife.org/radio-archives/episode/%s' % video_id, video_id)
  23. return {
  24. 'id': video_id,
  25. 'url': 'http://stream.thisamericanlife.org/{0}/stream/{0}_64k.m3u8'.format(video_id),
  26. 'protocol': 'm3u8_native',
  27. 'ext': 'm4a',
  28. 'acodec': 'aac',
  29. 'vcodec': 'none',
  30. 'abr': 64,
  31. 'title': self._html_search_meta(r'twitter:title', webpage, 'title', fatal=True),
  32. 'description': self._html_search_meta(r'description', webpage, 'description'),
  33. 'thumbnail': self._og_search_thumbnail(webpage),
  34. }