mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[screencastomatic] Fix extraction (Closes #9136)
This commit is contained in:
parent
443285aabe
commit
66fa495868
1 changed files with 11 additions and 24 deletions
|
@ -1,15 +1,11 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .jwplatform import JWPlatformBaseIE
|
||||||
from ..compat import compat_urlparse
|
from ..utils import js_to_json
|
||||||
from ..utils import (
|
|
||||||
ExtractorError,
|
|
||||||
js_to_json,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ScreencastOMaticIE(InfoExtractor):
|
class ScreencastOMaticIE(JWPlatformBaseIE):
|
||||||
_VALID_URL = r'https?://screencast-o-matic\.com/watch/(?P<id>[0-9a-zA-Z]+)'
|
_VALID_URL = r'https?://screencast-o-matic\.com/watch/(?P<id>[0-9a-zA-Z]+)'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://screencast-o-matic.com/watch/c2lD3BeOPl',
|
'url': 'http://screencast-o-matic.com/watch/c2lD3BeOPl',
|
||||||
|
@ -27,23 +23,14 @@ def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
setup_js = self._search_regex(
|
jwplayer_data = self._parse_json(
|
||||||
r"(?s)jwplayer\('mp4Player'\).setup\((\{.*?\})\);",
|
self._search_regex(
|
||||||
webpage, 'setup code')
|
r"(?s)jwplayer\('mp4Player'\).setup\((\{.*?\})\);", webpage, 'setup code'),
|
||||||
data = self._parse_json(setup_js, video_id, transform_source=js_to_json)
|
video_id, transform_source=js_to_json)
|
||||||
try:
|
|
||||||
video_data = next(
|
|
||||||
m for m in data['modes'] if m.get('type') == 'html5')
|
|
||||||
except StopIteration:
|
|
||||||
raise ExtractorError('Could not find any video entries!')
|
|
||||||
video_url = compat_urlparse.urljoin(url, video_data['config']['file'])
|
|
||||||
thumbnail = data.get('image')
|
|
||||||
|
|
||||||
return {
|
info_dict = self._parse_jwplayer_data(jwplayer_data, video_id, require_title=False)
|
||||||
'id': video_id,
|
info_dict.update({
|
||||||
'title': self._og_search_title(webpage),
|
'title': self._og_search_title(webpage),
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'url': video_url,
|
})
|
||||||
'ext': 'mp4',
|
return info_dict
|
||||||
'thumbnail': thumbnail,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue