]> git.bitcoin.ninja Git - youtube-dl/blob - youtube_dl/extractor/freespeech.py
[extractor/common] Move X-Forwarded-For setup code into _request_webpage
[youtube-dl] / youtube_dl / extractor / freespeech.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class FreespeechIE(InfoExtractor):
7     IE_NAME = 'freespeech.org'
8     _VALID_URL = r'https?://(?:www\.)?freespeech\.org/stories/(?P<id>.+)'
9     _TEST = {
10         'add_ie': ['Youtube'],
11         'url': 'http://www.freespeech.org/stories/fcc-announces-net-neutrality-rollback-whats-stake/',
12         'info_dict': {
13             'id': 'waRk6IPqyWM',
14             'ext': 'mp4',
15             'title': 'What\'s At Stake - Net Neutrality Special',
16             'description': 'Presented by MNN and FSTV',
17             'upload_date': '20170728',
18             'uploader_id': 'freespeechtv',
19             'uploader': 'freespeechtv',
20         },
21     }
22
23     def _real_extract(self, url):
24         display_id = self._match_id(url)
25         webpage = self._download_webpage(url, display_id)
26         youtube_url = self._search_regex(
27             r'data-video-url="([^"]+)"',
28             webpage, 'youtube url')
29
30         return {
31             '_type': 'url',
32             'url': youtube_url,
33             'ie_key': 'Youtube',
34         }