1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-05-19 11:39:28 +00:00
This commit is contained in:
Chocobozzz 2024-04-06 02:19:28 -07:00 committed by GitHub
commit e83207f5c3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -410,24 +410,24 @@ class PeerTubeIE(InfoExtractor):
video\.colibris-outilslibres\.org| video\.colibris-outilslibres\.org|
tube\.svnet\.fr| tube\.svnet\.fr|
peertube\.video| peertube\.video|
peertube3\.cpy\.re|
peertube2\.cpy\.re| peertube2\.cpy\.re|
peertube3\.cpy\.re|
videos\.tcit\.fr| videos\.tcit\.fr|
peertube\.cpy\.re| peertube\.cpy\.re|
canard\.tube canard\.tube
)''' )'''
_UUID_RE = r'[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}' _UUID_RE = r'[\da-zA-Z]{22}|[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}'
_API_BASE = 'https://%s/api/v1/videos/%s/%s' _API_BASE = 'https://%s/api/v1/videos/%s/%s'
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
(?: (?:
peertube:(?P<host>[^:]+):| peertube:(?P<host>[^:]+):|
https?://(?P<host_2>%s)/(?:videos/(?:watch|embed)|api/v\d/videos)/ https?://(?P<host_2>%s)/(?:videos/(?:watch|embed)|api/v\d/videos|w)/
) )
(?P<id>%s) (?P<id>%s)
''' % (_INSTANCES_RE, _UUID_RE) ''' % (_INSTANCES_RE, _UUID_RE)
_TESTS = [{ _TESTS = [{
'url': 'https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d', 'url': 'https://framatube.org/videos/watch/9c9de5e8-0a1e-484a-b099-e80766180a6d',
'md5': '9bed8c0137913e17b86334e5885aacff', 'md5': '8563064d245a4be5705bddb22bb00a28',
'info_dict': { 'info_dict': {
'id': '9c9de5e8-0a1e-484a-b099-e80766180a6d', 'id': '9c9de5e8-0a1e-484a-b099-e80766180a6d',
'ext': 'mp4', 'ext': 'mp4',
@ -451,6 +451,39 @@ class PeerTubeIE(InfoExtractor):
'tags': ['framasoft', 'peertube'], 'tags': ['framasoft', 'peertube'],
'categories': ['Science & Technology'], 'categories': ['Science & Technology'],
} }
}, {
'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',
'timestamp': 1589276219,
'upload_date': '20200512',
'uploader': 'chocobozzz',
}
}, {
'url': 'https://peertube2.cpy.re/w/3fbif9S3WmtTP8gGsC5HBd',
'info_dict': {
'id': '3fbif9S3WmtTP8gGsC5HBd',
'ext': 'mp4',
'title': 'E2E tests',
'uploader_id': '37855',
'timestamp': 1589276219,
'upload_date': '20200512',
'uploader': 'chocobozzz',
},
}, {
'url': 'https://peertube2.cpy.re/api/v1/videos/3fbif9S3WmtTP8gGsC5HBd',
'info_dict': {
'id': '3fbif9S3WmtTP8gGsC5HBd',
'ext': 'mp4',
'title': 'E2E tests',
'uploader_id': '37855',
'timestamp': 1589276219,
'upload_date': '20200512',
'uploader': 'chocobozzz',
},
}, { }, {
# Issue #26002 # Issue #26002
'url': 'peertube:spacepub.space:d8943b2d-8280-497b-85ec-bc282ec2afdc', 'url': 'peertube:spacepub.space:d8943b2d-8280-497b-85ec-bc282ec2afdc',
@ -484,12 +517,9 @@ class PeerTubeIE(InfoExtractor):
@staticmethod @staticmethod
def _extract_peertube_url(webpage, source_url): def _extract_peertube_url(webpage, source_url):
mobj = re.match( mobj = re.match(
r'https?://(?P<host>[^/]+)/videos/(?:watch|embed)/(?P<id>%s)' r'https?://(?P<host>[^/]+)/(?:videos/(?:watch|embed)|w)/(?P<id>%s)'
% PeerTubeIE._UUID_RE, source_url) % PeerTubeIE._UUID_RE, source_url)
if mobj and any(p in webpage for p in ( if mobj and 'meta property="og:platform" content="PeerTube"' in webpage:
'<title>PeerTube<',
'There will be other non JS-based clients to access PeerTube',
'>We are sorry but it seems that PeerTube is not compatible with your web browser.<')):
return 'peertube:%s:%s' % mobj.group('host', 'id') return 'peertube:%s:%s' % mobj.group('host', 'id')
@staticmethod @staticmethod
@ -570,7 +600,7 @@ class PeerTubeIE(InfoExtractor):
self._sort_formats(formats) self._sort_formats(formats)
description = video.get('description') description = video.get('description')
if len(description) >= 250: if description is not None and len(description) >= 250:
# description is shortened # description is shortened
full_description = self._call_api( full_description = self._call_api(
host, video_id, 'description', note='Downloading description JSON', host, video_id, 'description', note='Downloading description JSON',