From 14775e07e97b9c27c1762e2c6f199abab658a9b3 Mon Sep 17 00:00:00 2001 From: enigmaquip Date: Sat, 28 Oct 2017 20:46:26 -0600 Subject: [PATCH 1/2] [screencast] fix url extract for multiple file types --- youtube_dl/extractor/screencast.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/screencast.py b/youtube_dl/extractor/screencast.py index 62a6a8337..ea0e6592e 100644 --- a/youtube_dl/extractor/screencast.py +++ b/youtube_dl/extractor/screencast.py @@ -83,12 +83,12 @@ class ScreencastIE(InfoExtractor): video_url = video_url_raw.replace('http%3A', 'http:') if video_url is None: - video_meta = self._html_search_meta( + video_url = self._html_search_meta( 'og:video', webpage, default=None) - if video_meta: - video_url = self._search_regex( - r'src=(.*?)(?:$|&)', video_meta, - 'meta tag video URL', default=None) + + if video_url is None: + video_url = self._html_search_regex( + r'"MediaContentUrl":"([^"]+)"', webpage, 'embeds', default=None) if video_url is None: raise ExtractorError('Cannot find video') From 1426441ad78a17a95f820cd27b55f00638b9023f Mon Sep 17 00:00:00 2001 From: Enigmaquip Date: Sat, 11 Nov 2017 16:49:00 -0700 Subject: [PATCH 2/2] Simplify extractor --- youtube_dl/extractor/screencast.py | 47 +++++------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/youtube_dl/extractor/screencast.py b/youtube_dl/extractor/screencast.py index ea0e6592e..dfefec64d 100644 --- a/youtube_dl/extractor/screencast.py +++ b/youtube_dl/extractor/screencast.py @@ -62,45 +62,13 @@ class ScreencastIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) - video_url = self._html_search_regex( - r'Title: ([^<]+)', - r'class="tabSeperator">>(.+?)<', - r'([^<]+)'], - webpage, 'title') - thumbnail = self._og_search_thumbnail(webpage) + json_url = self._html_search_regex( + r'json\+oembed" href="([^"]+)"', webpage, + 'json embed', default=None) + data = self._download_json(json_url,video_id) + video_url = data.get('url') + title = data.get('title') or self._og_search_title(webpage, default=None) + thumbnail = data.get('thumbnail_url') or self._og_search_thumbnail(webpage, default=None) description = self._og_search_description(webpage, default=None) if description is None: description = self._html_search_meta('description', webpage) @@ -112,3 +80,4 @@ class ScreencastIE(InfoExtractor): 'description': description, 'thumbnail': thumbnail, } +