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