1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-06-29 07:09:33 +00:00

Add extractor for teleportal.ua

This commit is contained in:
Volodymyr 2022-02-07 18:30:39 +02:00
parent 734dfbb4e3
commit 8105f8ed84
2 changed files with 37 additions and 0 deletions

View file

@ -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,

View file

@ -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<id>[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:^<p>Не пропустіть.*',
}
}
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'),
}