From 0daa3d99ce204a615908092341c4f1d5717abb8c Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Mon, 9 Oct 2017 20:28:19 +0200 Subject: [PATCH 1/2] [slideslive] Add extractor (closes #2680) --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/slideslive.py | 36 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 youtube_dl/extractor/slideslive.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 24e9acda6..d0f71aecd 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -943,6 +943,7 @@ from .skynewsarabia import ( ) from .skysports import SkySportsIE from .slideshare import SlideshareIE +from .slideslive import SlidesLiveIE from .slutload import SlutloadIE from .smotri import ( SmotriIE, diff --git a/youtube_dl/extractor/slideslive.py b/youtube_dl/extractor/slideslive.py new file mode 100644 index 000000000..1531af5c9 --- /dev/null +++ b/youtube_dl/extractor/slideslive.py @@ -0,0 +1,36 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, +) + + +class SlidesLiveIE(InfoExtractor): + _VALID_URL = r'https://slideslive\.com/(?P[0-9]+)' + _TESTS = [{ + 'url': 'https://slideslive.com/38902413/gcc-ia16-backend', + 'md5': 'b29fcd6c6952d0c79c5079b0e7a07e6f', + 'info_dict': { + 'id': 'LMtgR8ba0b0', + 'ext': 'mp4', + 'title': '38902413: external video', + 'description': '3890241320170925-9-1yd6ech.mp4', + 'uploader': 'SlidesLive Administrator', + 'uploader_id': 'UC62SdArr41t_-_fX40QCLRw', + 'upload_date': '20170925', + } + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + video_data = self._download_json( + url, video_id, + headers={'Accept': 'application/json'}) + service_name = video_data['video_service_name'] + if service_name == 'YOUTUBE': + yt_video_id = video_data['video_service_id'] + return self.url_result(yt_video_id, 'Youtube', video_id=yt_video_id) + else: + raise ExtractorError('Unsupported service name: {0}'.format(service_name), expected=True) From ea807361882240242134359510fd81f25e3e23fa Mon Sep 17 00:00:00 2001 From: Sergey M Date: Tue, 10 Oct 2017 23:44:27 +0700 Subject: [PATCH 2/2] Update slideslive.py --- youtube_dl/extractor/slideslive.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/youtube_dl/extractor/slideslive.py b/youtube_dl/extractor/slideslive.py index 1531af5c9..104576033 100644 --- a/youtube_dl/extractor/slideslive.py +++ b/youtube_dl/extractor/slideslive.py @@ -2,13 +2,11 @@ from __future__ import unicode_literals from .common import InfoExtractor -from ..utils import ( - ExtractorError, -) +from ..utils import ExtractorError class SlidesLiveIE(InfoExtractor): - _VALID_URL = r'https://slideslive\.com/(?P[0-9]+)' + _VALID_URL = r'https?://slideslive\.com/(?P[0-9]+)' _TESTS = [{ 'url': 'https://slideslive.com/38902413/gcc-ia16-backend', 'md5': 'b29fcd6c6952d0c79c5079b0e7a07e6f', @@ -26,11 +24,11 @@ class SlidesLiveIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) video_data = self._download_json( - url, video_id, - headers={'Accept': 'application/json'}) + url, video_id, headers={'Accept': 'application/json'}) service_name = video_data['video_service_name'] if service_name == 'YOUTUBE': yt_video_id = video_data['video_service_id'] return self.url_result(yt_video_id, 'Youtube', video_id=yt_video_id) else: - raise ExtractorError('Unsupported service name: {0}'.format(service_name), expected=True) + raise ExtractorError( + 'Unsupported service name: {0}'.format(service_name), expected=True)