]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/screencastomatic.py
[youtube] Prefer UTC upload date for videos (#2223)
[yt-dlp.git] / yt_dlp / extractor / screencastomatic.py
CommitLineData
6e1b9395
PH
1# coding: utf-8
2from __future__ import unicode_literals
3
a4a554a7 4from .common import InfoExtractor
39ed931e 5from ..utils import (
6 get_element_by_class,
7 int_or_none,
8 remove_start,
9 strip_or_none,
10 unified_strdate,
11)
6e1b9395
PH
12
13
a4a554a7 14class ScreencastOMaticIE(InfoExtractor):
39ed931e 15 _VALID_URL = r'https?://screencast-o-matic\.com/(?:(?:watch|player)/|embed\?.*?\bsc=)(?P<id>[0-9a-zA-Z]+)'
16 _TESTS = [{
6e1b9395
PH
17 'url': 'http://screencast-o-matic.com/watch/c2lD3BeOPl',
18 'md5': '483583cb80d92588f15ccbedd90f0c18',
19 'info_dict': {
20 'id': 'c2lD3BeOPl',
21 'ext': 'mp4',
22 'title': 'Welcome to 3-4 Philosophy @ DECV!',
ec85ded8 23 'thumbnail': r're:^https?://.*\.jpg$',
6e1b9395 24 'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
39ed931e 25 'duration': 369,
26 'upload_date': '20141216',
6e1b9395 27 }
39ed931e 28 }, {
29 'url': 'http://screencast-o-matic.com/player/c2lD3BeOPl',
30 'only_matching': True,
31 }, {
32 'url': 'http://screencast-o-matic.com/embed?ff=true&sc=cbV2r4Q5TL&fromPH=true&a=1',
33 'only_matching': True,
34 }]
6e1b9395
PH
35
36 def _real_extract(self, url):
37 video_id = self._match_id(url)
39ed931e 38 webpage = self._download_webpage(
39 'https://screencast-o-matic.com/player/' + video_id, video_id)
40 info = self._parse_html5_media_entries(url, webpage, video_id)[0]
41 info.update({
42 'id': video_id,
43 'title': get_element_by_class('overlayTitle', webpage),
44 'description': strip_or_none(get_element_by_class('overlayDescription', webpage)) or None,
45 'duration': int_or_none(self._search_regex(
46 r'player\.duration\s*=\s*function\(\)\s*{\s*return\s+(\d+);\s*};',
47 webpage, 'duration', default=None)),
48 'upload_date': unified_strdate(remove_start(
49 get_element_by_class('overlayPublished', webpage), 'Published: ')),
66fa4958 50 })
39ed931e 51 return info