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