From cfad3bc792c54a3df2800008fa0da7a56178be82 Mon Sep 17 00:00:00 2001 From: 0x80 <0x80@negativezero.link> Date: Thu, 5 May 2022 00:00:00 +0000 Subject: [PATCH] [lbry] Support video pages without channel in URL. (Odysee uses Cloudflare and did not work over Tor.) --- src/extractors/lbry.py | 17 +++++++++++++++++ tests/lbry.txt | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/extractors/lbry.py b/src/extractors/lbry.py index f5367e8..505f85c 100644 --- a/src/extractors/lbry.py +++ b/src/extractors/lbry.py @@ -25,7 +25,24 @@ def extract_from_url (url, verbosity): if len(username) > 0 and username[0] == "@": return domain + "/$/rss/" + username +def extract_from_page (page, verbosity): + # for example, https://odysee.com/the-ultimate-guide-to-using-matrix!:4d33438b778316b59aa174264d9eb3ec347fed53 + # is canonically https://odysee.com/@techlore:3/the-ultimate-guide-to-using-matrix!#4 + canonical_url = search (page, '') + if canonical_url is None: + canonical_url = search (page, '') + + if not canonical_url is None: + return extract_from_url (canonical_url, verbosity) + def extract (url, page=None, network=False, verbosity=3, args={}): feed = extract_from_url (url, verbosity) if not feed is None: return feed + else: + notify ("Unable to get feed from URL alone", verbosity, platform) + if network: + page = download (platform, url, args, verbosity) + feed = extract_from_page (page, verbosity) + if not feed is None: + return feed diff --git a/tests/lbry.txt b/tests/lbry.txt index c701858..feab1fc 100644 --- a/tests/lbry.txt +++ b/tests/lbry.txt @@ -2,10 +2,13 @@ https://odysee.com/@techlore:3 https://odysee.com/$/rss/@techlore:3 https://odysee.com/@Coldfusion:f https://odysee.com/$/rss/@Coldfusion:f -# video page +# video page with channel in URL https://odysee.com/@techlore:3/the-dark-side-of-discord-(and-best:5 https://odysee.com/$/rss/@techlore:3 https://odysee.com/@Coldfusion:f/exploring-ai-generated-music:f https://odysee.com/$/rss/@Coldfusion:f +# video page without channel in URL +https://odysee.com/the-ultimate-guide-to-using-matrix!:4d33438b778316b59aa174264d9eb3ec347fed53 https://odysee.com/$/rss/@techlore:3 + # TODO: playlist pages # note: While odysee has a "playlists" tab for channels, I didn't see any # evidence (on 2021-09-22) that playlists are an actual thing that exists.