aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/theatlantic.py
blob: df4254fea06264d8852582f4fd49f3c7f4b30078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# coding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor


class TheAtlanticIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?theatlantic\.com/video/index/(?P<id>\d+)'
    _TEST = {
        'url': 'http://www.theatlantic.com/video/index/477918/capture-a-unified-theory-on-mental-health/',
        'md5': '',
        'info_dict': {
            'id': '477918',
            'ext': 'mp4',
            'title': 'Are All Mental Illnesses Related?',
            'description': 'Depression, anxiety, overeating, addiction, and all other mental disorders share a common mechanism.',
            'timestamp': 1460490952,
            'uploader': 'TheAtlantic',
            'upload_date': '20160412',
            'uploader_id': '29913724001',
        },
        'params': {
            # m3u8 download
            'skip_download': True,
        },
        'add_ie': ['BrightcoveLegacy'],
    }

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)
        return {
            '_type': 'url_transparent',
            'url': self._html_search_meta('twitter:player', webpage),
            'id': video_id,
            'title': self._og_search_title(webpage),
            'description': self._og_search_description(webpage),
            'thumbnail': self._og_search_thumbnail(webpage),
            'ie_key': 'BrightcoveLegacy',
        }