theatlantic.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class TheAtlanticIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?theatlantic\.com/video/index/(?P<id>\d+)'
  6. _TEST = {
  7. 'url': 'http://www.theatlantic.com/video/index/477918/capture-a-unified-theory-on-mental-health/',
  8. 'md5': '',
  9. 'info_dict': {
  10. 'id': '477918',
  11. 'ext': 'mp4',
  12. 'title': 'Are All Mental Illnesses Related?',
  13. 'description': 'Depression, anxiety, overeating, addiction, and all other mental disorders share a common mechanism.',
  14. 'timestamp': 1460490952,
  15. 'uploader': 'TheAtlantic',
  16. 'upload_date': '20160412',
  17. 'uploader_id': '29913724001',
  18. },
  19. 'params': {
  20. # m3u8 download
  21. 'skip_download': True,
  22. },
  23. 'add_ie': ['BrightcoveLegacy'],
  24. }
  25. def _real_extract(self, url):
  26. video_id = self._match_id(url)
  27. webpage = self._download_webpage(url, video_id)
  28. return {
  29. '_type': 'url_transparent',
  30. 'url': self._html_search_meta('twitter:player', webpage),
  31. 'id': video_id,
  32. 'title': self._og_search_title(webpage),
  33. 'description': self._og_search_description(webpage),
  34. 'thumbnail': self._og_search_thumbnail(webpage),
  35. 'ie_key': 'BrightcoveLegacy',
  36. }