1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-01-18 23:03:05 +01:00

[ie/puhutv] Fix extracting playlist

This commit fixes extracting playlist or episodes from *-detay (e.g.
https://puhutv.com/deha-detay).

This data extracted from android app.
This commit is contained in:
e2dk4r 2024-12-30 22:56:00 +03:00
parent 0b6b7742c2
commit 11da7fcf61

View file

@ -18,20 +18,21 @@ class PuhuTVIE(InfoExtractor):
IE_NAME = 'puhutv' IE_NAME = 'puhutv'
_TESTS = [{ _TESTS = [{
# film # film
'url': 'https://puhutv.com/sut-kardesler-izle', 'url': 'https://puhutv.com/bi-kucuk-eylul-meselesi-izle',
'md5': 'a347470371d56e1585d1b2c8dab01c96', 'md5': '4de98170ccb84c05779b1f046b3c86f8',
'info_dict': { 'info_dict': {
'id': '5085', 'id': '11909',
'display_id': 'sut-kardesler', 'display_id': 'bi-kucuk-eylul-meselesi',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Süt Kardeşler', 'title': 'Bi Küçük Eylül Meselesi',
'description': 'md5:ca09da25b7e57cbb5a9280d6e48d17aa', 'description': "Geçirdiği kazadan sonra son bir ayını hatırlamayan Eylül, bu süre içinde Bozcaada'da olduğunu öğrenir ve gerçeklerin peşine düşmek için Bozcaada'ya gider ve onu tanıyan Tekin adlı çizerle yakınlaşır.",
'thumbnail': r're:^https?://.*\.jpg$', 'thumbnail': r're:^https?://.*\.jpg$',
'duration': 4832.44, 'duration': 6176.96,
'creator': 'Arzu Film', 'creator': 'Ay Yapım',
'timestamp': 1561062602, 'creators': ['Ay Yapım'],
'timestamp': 1561062749,
'upload_date': '20190620', 'upload_date': '20190620',
'release_year': 1976, 'release_year': 2014,
'view_count': int, 'view_count': int,
'tags': list, 'tags': list,
}, },
@ -191,27 +192,29 @@ class PuhuTVSerieIE(InfoExtractor):
if not season_id: if not season_id:
continue continue
page = 1 page = 1
per = 100
has_more = True has_more = True
while has_more is True: while has_more is True:
season = self._download_json( season = self._download_json(
f'https://galadriel.puhutv.com/seasons/{season_id}', f'https://appservice.puhutv.com/api/seasons/{season_id}/episodes?v=2',
season_id, f'Downloading page {page}', query={ season_id, f'Downloading episode {(page - 1) * per}-{page * per} metadata', query={
'page': page, 'page': page,
'per': 40, 'per': per,
}) })['data']
episodes = season.get('episodes')
if isinstance(episodes, list): episodes = season['episodes']
for ep in episodes: for episode in episodes:
slug_path = str_or_none(ep.get('slugPath')) video_id = episode['id']
if not slug_path: video_title = episode['name']
continue slug = episode.get('slug') or episode['assets'][0]['slug']
video_id = str_or_none(int_or_none(ep.get('id'))) if not slug:
yield self.url_result( continue
f'https://puhutv.com/{slug_path}',
ie=PuhuTVIE.ie_key(), video_id=video_id, yield self.url_result(f'https://puhutv.com/{slug}',
video_title=ep.get('name') or ep.get('eventLabel')) ie=PuhuTVIE.ie_key(), video_id=video_id,
video_title=video_title)
page += 1 page += 1
has_more = season.get('hasMore') has_more = season['has_more']
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)