]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/screencastomatic.py
Import Upstream version 2020.01.24
[youtubedl] / youtube_dl / extractor / screencastomatic.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import js_to_json
6
7
8 class ScreencastOMaticIE(InfoExtractor):
9 _VALID_URL = r'https?://screencast-o-matic\.com/watch/(?P<id>[0-9a-zA-Z]+)'
10 _TEST = {
11 'url': 'http://screencast-o-matic.com/watch/c2lD3BeOPl',
12 'md5': '483583cb80d92588f15ccbedd90f0c18',
13 'info_dict': {
14 'id': 'c2lD3BeOPl',
15 'ext': 'mp4',
16 'title': 'Welcome to 3-4 Philosophy @ DECV!',
17 'thumbnail': r're:^https?://.*\.jpg$',
18 'description': 'as the title says! also: some general info re 1) VCE philosophy and 2) distance learning.',
19 'duration': 369.163,
20 }
21 }
22
23 def _real_extract(self, url):
24 video_id = self._match_id(url)
25 webpage = self._download_webpage(url, video_id)
26
27 jwplayer_data = self._parse_json(
28 self._search_regex(
29 r"(?s)jwplayer\('mp4Player'\).setup\((\{.*?\})\);", webpage, 'setup code'),
30 video_id, transform_source=js_to_json)
31
32 info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False)
33 info_dict.update({
34 'title': self._og_search_title(webpage),
35 'description': self._og_search_description(webpage),
36 })
37 return info_dict