From 7d740e7dc7149cfd93dde1fa47e9f314e72582c2 Mon Sep 17 00:00:00 2001 From: Hannu Hartikainen Date: Mon, 19 Oct 2020 17:56:23 +0000 Subject: [PATCH 1/3] [23video] Relax _VALID_URL (#26870) --- youtube_dl/extractor/twentythreevideo.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/twentythreevideo.py b/youtube_dl/extractor/twentythreevideo.py index aa0c6e90f..dc5609192 100644 --- a/youtube_dl/extractor/twentythreevideo.py +++ b/youtube_dl/extractor/twentythreevideo.py @@ -8,8 +8,8 @@ from ..utils import int_or_none class TwentyThreeVideoIE(InfoExtractor): IE_NAME = '23video' - _VALID_URL = r'https?://video\.(?Ptwentythree\.net|23video\.com|filmweb\.no)/v\.ihtml/player\.html\?(?P.*?\bphoto(?:_|%5f)id=(?P\d+).*)' - _TEST = { + _VALID_URL = r'https?://(?P[^.]+\.(?:twentythree\.net|23video\.com|filmweb\.no))/v\.ihtml/player\.html\?(?P.*?\bphoto(?:_|%5f)id=(?P\d+).*)' + _TESTS = [{ 'url': 'https://video.twentythree.net/v.ihtml/player.html?showDescriptions=0&source=site&photo%5fid=20448876&autoPlay=1', 'md5': '75fcf216303eb1dae9920d651f85ced4', 'info_dict': { @@ -21,11 +21,14 @@ class TwentyThreeVideoIE(InfoExtractor): 'uploader_id': '12258964', 'uploader': 'Rasmus Bysted', } - } + }, { + 'url': 'https://bonnier-publications-danmark.23video.com/v.ihtml/player.html?token=f0dc46476e06e13afd5a1f84a29e31e8&source=embed&photo%5fid=36137620', + 'only_matching': True, + }] def _real_extract(self, url): domain, query, photo_id = re.match(self._VALID_URL, url).groups() - base_url = 'https://video.%s' % domain + base_url = 'https://%s' % domain photo_data = self._download_json( base_url + '/api/photo/list?' + query, photo_id, query={ 'format': 'json', From 413fb7b0c3b0d8add6852f21fcd3b608e6409744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 20 Oct 2020 10:38:03 +0300 Subject: [PATCH 2/3] [eventive] Add eventive extractor skeleton --- youtube_dl/extractor/eventive.py | 30 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 31 insertions(+) create mode 100644 youtube_dl/extractor/eventive.py diff --git a/youtube_dl/extractor/eventive.py b/youtube_dl/extractor/eventive.py new file mode 100644 index 000000000..2248c8a00 --- /dev/null +++ b/youtube_dl/extractor/eventive.py @@ -0,0 +1,30 @@ +# coding: utf-8 +from __future__ import unicode_literals +import re +from .common import InfoExtractor + +class EventiveIE(InfoExtractor): + SUBTITLE_DATE_RE = re.compile(r'\((\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2})\)$') + + _VALID_URL = r'https://watch\.eventive\.org/account/play/(?P[a-f\d+]{24})(?:\?m=1)?' + _TESTS = [ + { + 'note': 'Test Url from issue: https://github.com/ytdl-org/youtube-dl/issues/26619', + 'url': 'https://watch.eventive.org/account/play/5f0368a74282a70029055ca8', + 'md5': '', + 'info_dict': { + 'id': '5f0368a74282a70029055ca8', + 'ext': 'mp4', + 'title': 'TEST YOUR DEVICE COMPATIBILITY', + 'thumbnail': r're:https://eventive.imgix.net/.*\.jpg$', + } + }, + ] + + def _real_extract(self, url): + video_id = self._match_id(url) + + info = { + 'id': video_id, + } + return info diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index ae7079a6a..290cd608b 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -327,6 +327,7 @@ from .espn import ( ) from .esri import EsriVideoIE from .europa import EuropaIE +from .eventive import EventiveIE from .everyonesmixtape import EveryonesMixtapeIE from .expotv import ExpoTVIE from .expressen import ExpressenIE From 5b4738b297bcae4b9222e786daab404e11c47f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 20 Oct 2020 12:35:06 +0300 Subject: [PATCH 3/3] [eventive]: Parse ISM manifest for formats --- youtube_dl/extractor/eventive.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/youtube_dl/extractor/eventive.py b/youtube_dl/extractor/eventive.py index 2248c8a00..c276e5376 100644 --- a/youtube_dl/extractor/eventive.py +++ b/youtube_dl/extractor/eventive.py @@ -2,6 +2,16 @@ from __future__ import unicode_literals import re from .common import InfoExtractor +from ..compat import ( + compat_etree_fromstring, + compat_urllib_parse_unquote_plus, +) +from ..utils import ( + urlencode_postdata, +) + +API_URL = 'https://api.eventive.org/watch/play' + class EventiveIE(InfoExtractor): SUBTITLE_DATE_RE = re.compile(r'\((\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2})\)$') @@ -24,7 +34,22 @@ class EventiveIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) + post = { + "event_id": video_id, + "film_id": "5f22387785a26f00360d29c9", + "token": "" + } + video = self._download_json(API_URL, video_id=video_id, data=urlencode_postdata(post)) + + formats = [] + for stream in video.get('playlist', []): + formats.extend(self._extract_ism_formats(stream['url'], video_id)) + self._sort_formats(formats) + info = { 'id': video_id, + 'title': stream['name'], + 'formats': formats, } + return info