From 91311f5f6b16bf59c950b136e7c5ca463802830a Mon Sep 17 00:00:00 2001 From: doe1080 <98906116+doe1080@users.noreply.github.com> Date: Wed, 16 Jul 2025 22:35:19 +0900 Subject: [PATCH] PeerTubeIE --- yt_dlp/extractor/generic.py | 28 ---------- yt_dlp/extractor/peertube.py | 105 +++++++++++++++++++++++++++++++---- 2 files changed, 95 insertions(+), 38 deletions(-) diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index bcb6ff3ba..c71e84d97 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -1023,34 +1023,6 @@ class GenericIE(InfoExtractor): 'uploader_id': 'b18ca46d-20df-4ff5-b0b3-aa7a00085617', }, 'params': {'extractor_args': {'generic': {'impersonate': ['chrome']}}}, - }, { - # ✅88 - # PeerTube embed - 'url': 'https://video.macver.org/w/6gvhZpUGQVd4SQ6oYDc9pC', - 'info_dict': { - 'id': '6gvhZpUGQVd4SQ6oYDc9pC', - 'ext': 'mp4', - 'title': 'Minecraft, but if you say a block, it gets deleted', - 'categories': ['Gaming'], - 'channel': 'Waffle Irons Gaming', - 'channel_id': '4', - 'channel_url': 'https://video.macver.org/video-channels/waffle_irons', - 'description': 'md5:eda8daf64b0dadd00cc248f28eef213c', - 'dislike_count': int, - 'duration': 1643, - 'license': 'Attribution - Non Commercial', - 'like_count': int, - 'tags': 'count:1', - 'thumbnail': r're:https?://video\.macver\.org/lazy-static/thumbnails/.+\.jpg', - 'timestamp': 1751142352, - 'upload_date': '20250628', - 'uploader': 'Bog', - 'uploader_id': '3', - 'uploader_url': 'https://video.macver.org/accounts/bog', - 'view_count': int, - }, - 'expected_warnings': ['HTTP Error 400: Bad Request', 'Ignoring subtitle tracks found in the HLS manifest'], - 'params': {'skip_download': True}, }, { # ✅124 # YoutubeIE diff --git a/yt_dlp/extractor/peertube.py b/yt_dlp/extractor/peertube.py index 2b69c7e6c..656f51e06 100644 --- a/yt_dlp/extractor/peertube.py +++ b/yt_dlp/extractor/peertube.py @@ -1331,7 +1331,7 @@ class PeerTubeIE(InfoExtractor): 'ext': 'mp4', 'title': 'What is PeerTube?', 'description': 'md5:3fefb8dde2b189186ce0719fda6f7b10', - 'thumbnail': r're:https?://.*\.(?:jpg|png)', + 'thumbnail': r're:https?://framatube\.org/lazy-static/thumbnails/.+\.jpg', 'timestamp': 1538391166, 'upload_date': '20181001', 'uploader': 'Framasoft', @@ -1346,19 +1346,34 @@ class PeerTubeIE(InfoExtractor): 'view_count': int, 'like_count': int, 'dislike_count': int, - 'tags': ['framasoft', 'peertube'], + 'tags': 'count:2', 'categories': ['Science & Technology'], }, + 'expected_warnings': ['HTTP Error 400: Bad Request'], + 'params': {'skip_download': 'm3u8'}, }, { 'url': 'https://peertube2.cpy.re/w/122d093a-1ede-43bd-bd34-59d2931ffc5e', 'info_dict': { 'id': '122d093a-1ede-43bd-bd34-59d2931ffc5e', 'ext': 'mp4', 'title': 'E2E tests', - 'uploader_id': '37855', + 'categories': ['Unknown'], + 'channel': 'Main chocobozzz channel', + 'channel_id': '5187', + 'channel_url': 'https://peertube2.cpy.re/video-channels/chocobozzz_channel', + 'description': 'md5:67daf92c833c41c95db874e18fcb2786', + 'dislike_count': int, + 'duration': 52, + 'license': 'Unknown', + 'like_count': int, + 'tags': [], + 'thumbnail': r're:https?://peertube2\.cpy\.re/lazy-static/thumbnails/.+\.jpg', 'timestamp': 1589276219, 'upload_date': '20200512', 'uploader': 'chocobozzz', + 'uploader_id': '37855', + 'uploader_url': 'https://peertube2.cpy.re/accounts/chocobozzz', + 'view_count': int, }, }, { 'url': 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd', @@ -1366,10 +1381,23 @@ class PeerTubeIE(InfoExtractor): 'id': '3fbif9S3WmtTP8gGsC5HBd', 'ext': 'mp4', 'title': 'E2E tests', - 'uploader_id': '37855', + 'categories': ['Unknown'], + 'channel': 'Main chocobozzz channel', + 'channel_id': '5187', + 'channel_url': 'https://peertube2.cpy.re/video-channels/chocobozzz_channel', + 'description': 'md5:67daf92c833c41c95db874e18fcb2786', + 'dislike_count': int, + 'duration': 52, + 'license': 'Unknown', + 'like_count': int, + 'tags': [], + 'thumbnail': r're:https?://peertube2\.cpy\.re/lazy-static/thumbnails/.+\.jpg', 'timestamp': 1589276219, 'upload_date': '20200512', 'uploader': 'chocobozzz', + 'uploader_id': '37855', + 'uploader_url': 'https://peertube2.cpy.re/accounts/chocobozzz', + 'view_count': int, }, }, { 'url': 'https://peertube2.cpy.re/api/v1/videos/3fbif9S3WmtTP8gGsC5HBd', @@ -1377,13 +1405,26 @@ class PeerTubeIE(InfoExtractor): 'id': '3fbif9S3WmtTP8gGsC5HBd', 'ext': 'mp4', 'title': 'E2E tests', - 'uploader_id': '37855', + 'categories': ['Unknown'], + 'channel': 'Main chocobozzz channel', + 'channel_id': '5187', + 'channel_url': 'https://peertube2.cpy.re/video-channels/chocobozzz_channel', + 'description': 'md5:67daf92c833c41c95db874e18fcb2786', + 'dislike_count': int, + 'duration': 52, + 'license': 'Unknown', + 'like_count': int, + 'tags': [], + 'thumbnail': r're:https?://peertube2\.cpy\.re/lazy-static/thumbnails/.+\.jpg', 'timestamp': 1589276219, 'upload_date': '20200512', 'uploader': 'chocobozzz', + 'uploader_id': '37855', + 'uploader_url': 'https://peertube2.cpy.re/accounts/chocobozzz', + 'view_count': int, }, }, { - # Issue #26002 + # https://github.com/ytdl-org/youtube-dl/issues/26002 'url': 'peertube:spacepub.space:d8943b2d-8280-497b-85ec-bc282ec2afdc', 'info_dict': { 'id': 'd8943b2d-8280-497b-85ec-bc282ec2afdc', @@ -1394,6 +1435,7 @@ class PeerTubeIE(InfoExtractor): 'upload_date': '20200420', 'uploader': 'Drew DeVault', }, + 'skip': 'Invalid URL', }, { 'url': 'https://peertube.debian.social/videos/watch/0b04f13d-1e18-4f1d-814e-4979aa7c9c44', 'only_matching': True, @@ -1411,6 +1453,33 @@ class PeerTubeIE(InfoExtractor): 'url': 'peertube:framatube.org:b37a5b9f-e6b5-415c-b700-04a5cd6ec205', 'only_matching': True, }] + _WEBPAGE_TESTS = [{ + 'url': 'https://video.macver.org/w/6gvhZpUGQVd4SQ6oYDc9pC', + 'info_dict': { + 'id': '6gvhZpUGQVd4SQ6oYDc9pC', + 'ext': 'mp4', + 'title': 'Minecraft, but if you say a block, it gets deleted', + 'categories': ['Gaming'], + 'channel': 'Waffle Irons Gaming', + 'channel_id': '4', + 'channel_url': 'https://video.macver.org/video-channels/waffle_irons', + 'description': 'md5:eda8daf64b0dadd00cc248f28eef213c', + 'dislike_count': int, + 'duration': 1643, + 'license': 'Attribution - Non Commercial', + 'like_count': int, + 'tags': 'count:1', + 'thumbnail': r're:https?://video\.macver\.org/lazy-static/thumbnails/.+\.jpg', + 'timestamp': 1751142352, + 'upload_date': '20250628', + 'uploader': 'Bog', + 'uploader_id': '3', + 'uploader_url': 'https://video.macver.org/accounts/bog', + 'view_count': int, + }, + 'expected_warnings': ['HTTP Error 400: Bad Request', 'Ignoring subtitle tracks found in the HLS manifest'], + 'params': {'skip_download': 'm3u8'}, + }] @staticmethod def _extract_peertube_url(webpage, source_url): @@ -1578,33 +1647,49 @@ class PeerTubePlaylistIE(InfoExtractor): 'url': 'https://peertube.debian.social/w/p/hFdJoTuyhNJVa1cDWd1d12', 'info_dict': { 'id': 'hFdJoTuyhNJVa1cDWd1d12', - 'description': 'Diversas palestras do Richard Stallman no Brasil.', 'title': 'Richard Stallman no Brasil', + 'channel': 'debianbrazilteam', + 'channel_id': 1522, + 'description': 'md5:e2d3ef4626ed10f287b43b6289cb87a5', + 'thumbnail': r're:https?://peertube\.debian\.social/lazy-static/thumbnails/.+\.jpg', 'timestamp': 1599676222, + 'upload_date': '20200909', }, 'playlist_mincount': 9, }, { 'url': 'https://peertube2.cpy.re/a/chocobozzz/videos', 'info_dict': { 'id': 'chocobozzz', - 'timestamp': 1553874564, 'title': 'chocobozzz', + 'channel': 'chocobozzz', + 'channel_id': 37855, + 'thumbnail': '', + 'timestamp': 1553874564, + 'upload_date': '20190329', }, 'playlist_mincount': 2, }, { 'url': 'https://framatube.org/c/bf54d359-cfad-4935-9d45-9d6be93f63e8/videos', 'info_dict': { 'id': 'bf54d359-cfad-4935-9d45-9d6be93f63e8', - 'timestamp': 1519917377, 'title': 'Les vidéos de Framasoft', + 'channel': 'framasoft', + 'channel_id': 3, + 'thumbnail': '', + 'timestamp': 1519917377, + 'upload_date': '20180301', }, 'playlist_mincount': 345, }, { 'url': 'https://peertube2.cpy.re/c/blender_open_movies@video.blender.org/videos', 'info_dict': { 'id': 'blender_open_movies@video.blender.org', - 'timestamp': 1542287810, 'title': 'Official Blender Open Movies', + 'channel': 'blender', + 'channel_id': 1926, + 'thumbnail': '', + 'timestamp': 1540472902, + 'upload_date': '20181025', }, 'playlist_mincount': 11, }]