1 from .common
import InfoExtractor
13 class ScreencastOMaticIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://screencast-o-matic\.com/(?:(?:watch|player)/|embed\?.*?\bsc=)(?P<id>[0-9a-zA-Z]+)'
16 'url': 'http://screencast-o-matic.com/watch/c2lD3BeOPl',
17 'md5': '483583cb80d92588f15ccbedd90f0c18',
21 'title': 'Welcome to 3-4 Philosophy @ DECV!',
22 'thumbnail': r
're:^https?://.*\.jpg$',
23 'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
25 'upload_date': '20141216',
28 'url': 'http://screencast-o-matic.com/player/c2lD3BeOPl',
29 'only_matching': True,
31 'url': 'http://screencast-o-matic.com/embed?ff=true&sc=cbV2r4Q5TL&fromPH=true&a=1',
32 'only_matching': True,
35 def _real_extract(self
, url
):
36 video_id
= self
._match
_id
(url
)
37 webpage
= self
._download
_webpage
(
38 'https://screencast-o-matic.com/player/' + video_id
, video_id
)
40 if (self
._html
_extract
_title
(webpage
) == 'Protected Content'
41 or 'This video is private and requires a password' in webpage
):
42 password
= self
.get_param('videopassword')
45 raise ExtractorError('Password protected video, use --video-password <password>', expected
=True)
47 form
= self
._search
_regex
(
48 r
'(?is)<form[^>]*>(?P<form>.+?)</form>', webpage
, 'login form', group
='form')
49 form_data
= self
._hidden
_inputs
(form
)
51 'scPassword': password
,
54 webpage
= self
._download
_webpage
(
55 'https://screencast-o-matic.com/player/password', video_id
, 'Logging in',
56 data
=urlencode_postdata(form_data
))
58 if '<small class="text-danger">Invalid password</small>' in webpage
:
59 raise ExtractorError('Unable to login: Invalid password', expected
=True)
61 info
= self
._parse
_html
5_media
_entries
(url
, webpage
, video_id
)[0]
64 'title': get_element_by_class('overlayTitle', webpage
),
65 'description': strip_or_none(get_element_by_class('overlayDescription', webpage
)) or None,
66 'duration': int_or_none(self
._search
_regex
(
67 r
'player\.duration\s*=\s*function\(\)\s*{\s*return\s+(\d+);\s*};',
68 webpage
, 'duration', default
=None)),
69 'upload_date': unified_strdate(remove_start(
70 get_element_by_class('overlayPublished', webpage
), 'Published: ')),