1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-01-31 12:32:27 +01:00

Update piramidetv.py

This commit is contained in:
kclauhk 2025-01-16 09:43:43 +08:00
parent 1be3d718a8
commit f407f5fb19

View file

@ -34,8 +34,8 @@ class PiramideTVIE(InfoExtractor):
}]
def _extract_video(self, video_id):
if video_data := self._download_json(
f'https://hermes.piramide.tv/video/data/{video_id}', video_id, fatal=False):
video_data = self._download_json(
f'https://hermes.piramide.tv/video/data/{video_id}', video_id, fatal=False)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
f'https://cdn.piramide.tv/video/{video_id}/manifest.m3u8', video_id, fatal=False)
next_video = traverse_obj(video_data, ('video', 'next_video', 'id', {str}))
@ -43,8 +43,6 @@ class PiramideTVIE(InfoExtractor):
'id': video_id,
'formats': formats,
'subtitles': subtitles,
'webpage_url': f'https://piramide.tv/video/{video_id}',
'original_url': f'https://piramide.tv/video/{video_id}',
**traverse_obj(video_data, ('video', {
'id': ('id', {str}),
'title': ('title', {str}),
@ -55,7 +53,6 @@ class PiramideTVIE(InfoExtractor):
'timestamp': ('date', {parse_iso8601}),
})),
}
return None, {'id': video_id}
def _entries(self, video_id):
visited = set()
@ -88,15 +85,13 @@ class PiramideTVChannelIE(InfoExtractor):
def _entries(self, channel_name):
videos = self._download_json(
f'https://hermes.piramide.tv/channel/list/{channel_name}/date/100000', channel_name)
for video in videos.get('videos', []):
if video_id := video.get('id'):
for video in traverse_obj(videos, ('videos', lambda _, v: v['id'])):
yield self.url_result(smuggle_url(
f'https://piramide.tv/video/{video_id}', {'force_noplaylist': True}),
f'https://piramide.tv/video/{video['id']}', {'force_noplaylist': True}),
**traverse_obj(video, {
'id': ('id', {str}),
'title': ('title', {str}),
'description': ('description', {str}),
'webpage_url': ('id', {str}, {lambda v: f'https://piramide.tv/video/{v}'}),
}))
def _real_extract(self, url):