]>
Commit | Line | Data |
---|---|---|
352d08e3 JMF |
1 | from __future__ import unicode_literals |
2 | ||
3 | import re | |
4 | import json | |
5 | ||
6 | from .common import InfoExtractor | |
7 | ||
8 | ||
9 | class FreespeechIE(InfoExtractor): | |
10 | IE_NAME = 'freespeech.org' | |
92519402 | 11 | _VALID_URL = r'https?://(?:www\.)?freespeech\.org/video/(?P<title>.+)' |
352d08e3 JMF |
12 | _TEST = { |
13 | 'add_ie': ['Youtube'], | |
14 | 'url': 'https://www.freespeech.org/video/obama-romney-campaign-colorado-ahead-debate-0', | |
15 | 'info_dict': { | |
16 | 'id': 'poKsVCZ64uU', | |
f22ba4bd | 17 | 'ext': 'webm', |
352d08e3 JMF |
18 | 'title': 'Obama, Romney Campaign in Colorado Ahead of Debate', |
19 | 'description': 'Obama, Romney Campaign in Colorado Ahead of Debate', | |
20 | 'uploader': 'freespeechtv', | |
21 | 'uploader_id': 'freespeechtv', | |
22 | 'upload_date': '20121002', | |
23 | }, | |
24 | } | |
25 | ||
26 | def _real_extract(self, url): | |
27 | mobj = re.match(self._VALID_URL, url) | |
28 | title = mobj.group('title') | |
29 | webpage = self._download_webpage(url, title) | |
197224b7 | 30 | info_json = self._search_regex(r'jQuery\.extend\(Drupal\.settings, ({.*?})\);', webpage, 'info') |
352d08e3 JMF |
31 | info = json.loads(info_json) |
32 | ||
33 | return { | |
34 | '_type': 'url', | |
35 | 'url': info['jw_player']['basic_video_node_player']['file'], | |
36 | 'ie_key': 'Youtube', | |
37 | } |