]>
Commit | Line | Data |
---|---|---|
1b40dc92 DK |
1 | import re |
2 | ||
3 | from .common import InfoExtractor | |
3e675fab PH |
4 | from ..utils import ( |
5 | int_or_none, | |
6 | parse_duration, | |
7 | parse_iso8601, | |
8 | ) | |
1b40dc92 DK |
9 | |
10 | ||
11 | class AirMozillaIE(InfoExtractor): | |
12 | _VALID_URL = r'https?://air\.mozilla\.org/(?P<id>[0-9a-z-]+)/?' | |
13 | _TEST = { | |
14 | 'url': 'https://air.mozilla.org/privacy-lab-a-meetup-for-privacy-minded-people-in-san-francisco/', | |
4c039732 | 15 | 'md5': '8d02f53ee39cf006009180e21df1f3ba', |
1b40dc92 DK |
16 | 'info_dict': { |
17 | 'id': '6x4q2w', | |
18 | 'ext': 'mp4', | |
19 | 'title': 'Privacy Lab - a meetup for privacy minded people in San Francisco', | |
4c039732 | 20 | 'thumbnail': r're:https?://.*/poster\.jpg', |
1b40dc92 DK |
21 | 'description': 'Brings together privacy professionals and others interested in privacy at for-profits, non-profits, and NGOs in an effort to contribute to the state of the ecosystem...', |
22 | 'timestamp': 1422487800, | |
23 | 'upload_date': '20150128', | |
24 | 'location': 'SFO Commons', | |
25 | 'duration': 3780, | |
26 | 'view_count': int, | |
7465222a | 27 | 'categories': ['Main', 'Privacy'], |
1b40dc92 DK |
28 | } |
29 | } | |
30 | ||
1b40dc92 DK |
31 | def _real_extract(self, url): |
32 | display_id = self._match_id(url) | |
33 | webpage = self._download_webpage(url, display_id) | |
4c039732 | 34 | video_id = self._html_search_regex(r'//vid\.ly/(.*?)/embed', webpage, 'id') |
1b40dc92 DK |
35 | |
36 | embed_script = self._download_webpage('https://vid.ly/{0}/embed'.format(video_id), video_id) | |
4c039732 YCH |
37 | jwconfig = self._parse_json(self._search_regex( |
38 | r'initCallback\((.*)\);', embed_script, 'metadata'), video_id)['config'] | |
1b40dc92 | 39 | |
4c039732 | 40 | info_dict = self._parse_jwplayer_data(jwconfig, video_id) |
3e675fab PH |
41 | view_count = int_or_none(self._html_search_regex( |
42 | r'Views since archived: ([0-9]+)', | |
43 | webpage, 'view count', fatal=False)) | |
44 | timestamp = parse_iso8601(self._html_search_regex( | |
45 | r'<time datetime="(.*?)"', webpage, 'timestamp', fatal=False)) | |
46 | duration = parse_duration(self._search_regex( | |
47 | r'Duration:\s*(\d+\s*hours?\s*\d+\s*minutes?)', | |
48 | webpage, 'duration', fatal=False)) | |
1b40dc92 | 49 | |
4c039732 | 50 | info_dict.update({ |
1b40dc92 DK |
51 | 'id': video_id, |
52 | 'title': self._og_search_title(webpage), | |
1b40dc92 DK |
53 | 'url': self._og_search_url(webpage), |
54 | 'display_id': display_id, | |
1b40dc92 | 55 | 'description': self._og_search_description(webpage), |
3e675fab | 56 | 'timestamp': timestamp, |
1b40dc92 | 57 | 'location': self._html_search_regex(r'Location: (.*)', webpage, 'location', default=None), |
3e675fab PH |
58 | 'duration': duration, |
59 | 'view_count': view_count, | |
1b40dc92 | 60 | 'categories': re.findall(r'<a href=".*?" class="channel">(.*?)</a>', webpage), |
4c039732 YCH |
61 | }) |
62 | ||
63 | return info_dict |