From 8105f8ed844304a07806813ee89e461e61316d76 Mon Sep 17 00:00:00 2001 From: Volodymyr Date: Mon, 7 Feb 2022 18:30:39 +0200 Subject: [PATCH] Add extractor for teleportal.ua --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/teleportal.py | 36 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 youtube_dl/extractor/teleportal.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 50b7cb4a0..2fbf921ec 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1227,6 +1227,7 @@ from .telebruxelles import TeleBruxellesIE from .telecinco import TelecincoIE from .telegraaf import TelegraafIE from .telemb import TeleMBIE +from .teleportal import TeleportalIE from .telequebec import ( TeleQuebecIE, TeleQuebecSquatIE, diff --git a/youtube_dl/extractor/teleportal.py b/youtube_dl/extractor/teleportal.py new file mode 100644 index 000000000..b254ee3dc --- /dev/null +++ b/youtube_dl/extractor/teleportal.py @@ -0,0 +1,36 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class TeleportalIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?teleportal\.ua(/ua)?/(?P[0-9a-z-/]+)' + _TEST = { + 'url': 'https://teleportal.ua/ua/show/stb/master-cheff/bitva-sezonov/vypusk-3', + 'md5': '07bd056c45b515fa9cc0202b8403df41', + 'info_dict': { + 'id': 'show/stb/master-cheff/bitva-sezonov/vypusk-3', + 'ext': 'mp4', + 'title': 'МастерШеф. Битва сезонів 3 випуск: найогидніший випуск сезону!', + 'thumbnail': r're:^https?://.*\.jpg$', + 'description': r're:^

Не пропустіть.*', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + backend_url = 'https://tp-back.starlight.digital/ua/{}'.format(video_id) + metadata = self._download_json(backend_url, video_id) + api_metadata = self._download_json('https://vcms-api2.starlight.digital/player-api/{}?referer=https://teleportal.ua/&lang=ua'.format(metadata["hash"]), video_id) + + return { + 'id': video_id, + 'title': metadata['title'], + 'description': metadata['description'], + 'real_id': metadata['id'], + 'hash': metadata['hash'], + 'url': api_metadata['video'][0]['mediaHls'], + 'thumbnail': api_metadata['video'][0]['poster'], + 'formats': self._extract_m3u8_formats(api_metadata['video'][0]['mediaHls'], video_id, 'mp4'), + }