From 44a7c656a3ff76357dbd5a1169ab8b19bb4fefd4 Mon Sep 17 00:00:00 2001 From: Inias Peeters Date: Fri, 29 Oct 2021 12:02:41 +0200 Subject: [PATCH] Add livestream.kuleuven.be extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/kuleuven_live.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 youtube_dl/extractor/kuleuven_live.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 6e8fc3961..ffdd681e4 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -548,6 +548,7 @@ from .kinopoisk import KinoPoiskIE from .konserthusetplay import KonserthusetPlayIE from .krasview import KrasViewIE from .ku6 import Ku6IE +from .kuleuven_live import KULLiveIE from .kusi import KUSIIE from .kuwo import ( KuwoIE, diff --git a/youtube_dl/extractor/kuleuven_live.py b/youtube_dl/extractor/kuleuven_live.py new file mode 100644 index 000000000..aff52d6a8 --- /dev/null +++ b/youtube_dl/extractor/kuleuven_live.py @@ -0,0 +1,24 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class KULLiveIE(InfoExtractor): + _VALID_URL = r'(?:(?:https?://(?:www\.)?livestream.kuleuven\.be/\?pin=)|kulive:)(?P[0-9]+)' + BACKEND_BASE_URL = "https://icts-p-toledo-streaming-video-live-backend.cloud.icts.kuleuven.be/api/viewers/" + + def _real_extract(self, url): + pin = self._match_id(url) + + json_res = self._download_json(self.BACKEND_BASE_URL + pin, pin, 'Requesting stream URL') + m3u8_url = json_res['streamUrl'] + + formats = self._extract_m3u8_formats(m3u8_url, pin, 'mp4') + + return { + 'id': pin, + 'title': 'kul-stream', + 'is_live': True, + 'formats': formats, + }