From c22c8b92ea63380b9f1c5734c4d1c056ba55492c Mon Sep 17 00:00:00 2001 From: nixxo Date: Fri, 19 Feb 2021 16:37:44 +0100 Subject: [PATCH] [lbry] lbry:// url protocol support closes #28084 --- youtube_dl/extractor/lbry.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/lbry.py b/youtube_dl/extractor/lbry.py index 413215a99..756b79717 100644 --- a/youtube_dl/extractor/lbry.py +++ b/youtube_dl/extractor/lbry.py @@ -21,9 +21,9 @@ from ..utils import ( class LBRYBaseIE(InfoExtractor): - _BASE_URL_REGEX = r'https?://(?:www\.)?(?:lbry\.tv|odysee\.com)/' + _BASE_URL_REGEX = r'(?:https?://(?:www\.)?(?:lbry\.tv|odysee\.com)/|lbry://)' _CLAIM_ID_REGEX = r'[0-9a-f]{1,40}' - _OPT_CLAIM_ID = '[^:/?#&]+(?::%s)?' % _CLAIM_ID_REGEX + _OPT_CLAIM_ID = '[^:/?#&]+(?:[:#]%s)?' % _CLAIM_ID_REGEX _SUPPORTED_STREAM_TYPES = ['video', 'audio'] def _call_api_proxy(self, method, display_id, params, resource): @@ -41,7 +41,9 @@ class LBRYBaseIE(InfoExtractor): 'resolve', display_id, {'urls': url}, resource)[url] def _permanent_url(self, url, claim_name, claim_id): - return urljoin(url, '/%s:%s' % (claim_name, claim_id)) + return urljoin( + url.replace('lbry://', 'https://lbry.tv/'), + '/%s:%s' % (claim_name, claim_id)) def _parse_stream(self, stream, url): stream_value = stream.get('value') or {} @@ -137,6 +139,10 @@ class LBRYIE(LBRYBaseIE): }, { 'url': 'https://lbry.tv/@lacajadepandora:a/TRUMP-EST%C3%81-BIEN-PUESTO-con-Pilar-Baselga,-Carlos-Senra,-Luis-Palacios-(720p_30fps_H264-192kbit_AAC):1', 'only_matching': True, + }, { + # lbry protocol support (#28084) + 'url': 'lbry://@lbry#3f/odysee#7', + 'only_matching': True, }] def _real_extract(self, url): @@ -178,6 +184,10 @@ class LBRYChannelIE(LBRYBaseIE): }, { 'url': 'https://lbry.tv/@LBRYFoundation', 'only_matching': True, + }, { + # lbry protocol support (#28084) + 'url': 'lbry://@lbry#3f', + 'only_matching': True, }] _PAGE_SIZE = 50