X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fairmozilla.py;h=f8e70f4e580746093d97e3d2d596d008ed3e6c15;hb=5c2266df4b9aeb7881ed8c026a038e2a25e43734;hp=44c20f8861168da0489f4c9cbfc056fcf085aac1;hpb=1b40dc92eb27b2a3f299157f83bfc8e95ca42268;p=youtube-dl diff --git a/youtube_dl/extractor/airmozilla.py b/youtube_dl/extractor/airmozilla.py index 44c20f886..f8e70f4e5 100644 --- a/youtube_dl/extractor/airmozilla.py +++ b/youtube_dl/extractor/airmozilla.py @@ -4,7 +4,11 @@ from __future__ import unicode_literals import re from .common import InfoExtractor -from ..utils import parse_iso8601 +from ..utils import ( + int_or_none, + parse_duration, + parse_iso8601, +) class AirMozillaIE(InfoExtractor): @@ -16,24 +20,17 @@ class AirMozillaIE(InfoExtractor): 'id': '6x4q2w', 'ext': 'mp4', 'title': 'Privacy Lab - a meetup for privacy minded people in San Francisco', - 'thumbnail': 're:https://\w+\.cloudfront\.net/6x4q2w/poster\.jpg\?t=\d+', + 'thumbnail': 're:https?://vid\.ly/(?P[0-9a-z-]+)/poster', '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...', 'timestamp': 1422487800, 'upload_date': '20150128', 'location': 'SFO Commons', 'duration': 3780, 'view_count': int, - 'categories': ['Main'], + 'categories': ['Main', 'Privacy'], } } - _QUALITY_MAP = { - '360p': 0, - '576p': 1, - '640p': 2, - '720p': 3, - } - def _real_extract(self, url): display_id = self._match_id(url) webpage = self._download_webpage(url, display_id) @@ -43,19 +40,23 @@ class AirMozillaIE(InfoExtractor): jwconfig = self._search_regex(r'\svar jwconfig = (\{.*?\});\s', embed_script, 'metadata') metadata = self._parse_json(jwconfig, video_id) - formats = [] - for source in metadata['playlist'][0]['sources']: - fmt = { - 'url': source['file'], - 'ext': source['type'], - 'format_id': self._search_regex(r'&format=(.*)$', source['file'], 'video format'), - 'resolution': source['label'], - 'quality': self._QUALITY_MAP.get(source['label'], -1), - } - formats.append(fmt) + formats = [{ + 'url': source['file'], + 'ext': source['type'], + 'format_id': self._search_regex(r'&format=(.*)$', source['file'], 'video format'), + 'format': source['label'], + 'height': int(source['label'].rstrip('p')), + } for source in metadata['playlist'][0]['sources']] self._sort_formats(formats) - duration_match = re.search(r'Duration:(?: (?P\d+) hours?)?(?: (?P\d+) minutes?)?', webpage) + view_count = int_or_none(self._html_search_regex( + r'Views since archived: ([0-9]+)', + webpage, 'view count', fatal=False)) + timestamp = parse_iso8601(self._html_search_regex( + r'