2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..compat import compat_urlparse
15 class EsriVideoIE(InfoExtractor):
16 _VALID_URL = r'https?://video\.esri\.com/watch/(?P<id>[0-9]+)'
18 'url': 'https://video.esri.com/watch/1124/arcgis-online-_dash_-developing-applications',
19 'md5': 'd4aaf1408b221f1b38227a9bbaeb95bc',
23 'title': 'ArcGIS Online - Developing Applications',
24 'description': 'Jeremy Bartley demonstrates how to develop applications with ArcGIS Online.',
25 'thumbnail': 're:^https?://.*\.jpg$',
27 'upload_date': '20120419',
31 def _real_extract(self, url):
32 video_id = self._match_id(url)
34 webpage = self._download_webpage(url, video_id)
37 for width, height, content in re.findall(
38 r'(?s)<li><strong>(\d+)x(\d+):</strong>(.+?)</li>', webpage):
39 for video_url, ext, filesize in re.findall(
40 r'<a[^>]+href="([^"]+)">([^<]+) \(([^<]+)\)</a>', content):
42 'url': compat_urlparse.urljoin(url, video_url),
44 'format_id': '%s-%s' % (ext.lower(), height),
46 'height': int(height),
47 'filesize_approx': parse_filesize(filesize),
49 self._sort_formats(formats)
51 title = self._html_search_meta('title', webpage, 'title')
52 description = self._html_search_meta(
53 'description', webpage, 'description', fatal=False)
55 thumbnail = self._html_search_meta('thumbnail', webpage, 'thumbnail', fatal=False)
57 thumbnail = re.sub(r'_[st]\.jpg$', '_x.jpg', thumbnail)
59 duration = int_or_none(self._search_regex(
60 [r'var\s+videoSeconds\s*=\s*(\d+)', r"'duration'\s*:\s*(\d+)"],
61 webpage, 'duration', fatal=False))
63 upload_date = unified_strdate(self._html_search_meta(
64 'last-modified', webpage, 'upload date', fatal=None))
69 'description': description,
70 'thumbnail': thumbnail,
72 'upload_date': upload_date,