[lbry] Support video pages without channel in URL.

(Odysee uses Cloudflare and did not work over Tor.)
This commit is contained in:
0x80 2022-05-05 00:00:00 +00:00
parent 9e62ea230b
commit cfad3bc792
Signed by: 0x80
GPG Key ID: 68368BCBC000EF51
2 changed files with 21 additions and 1 deletions

View File

@ -25,7 +25,24 @@ def extract_from_url (url, verbosity):
if len(username) > 0 and username[0] == "@": if len(username) > 0 and username[0] == "@":
return domain + "/$/rss/" + username 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, '<link rel="canonical" content="', '"/>')
if canonical_url is None:
canonical_url = search (page, '<meta property="og:url" content="', '"/>')
if not canonical_url is None:
return extract_from_url (canonical_url, verbosity)
def extract (url, page=None, network=False, verbosity=3, args={}): def extract (url, page=None, network=False, verbosity=3, args={}):
feed = extract_from_url (url, verbosity) feed = extract_from_url (url, verbosity)
if not feed is None: if not feed is None:
return feed 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

View File

@ -2,10 +2,13 @@
https://odysee.com/@techlore:3 https://odysee.com/$/rss/@techlore:3 https://odysee.com/@techlore:3 https://odysee.com/$/rss/@techlore:3
https://odysee.com/@Coldfusion:f https://odysee.com/$/rss/@Coldfusion:f 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/@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 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 # TODO: playlist pages
# note: While odysee has a "playlists" tab for channels, I didn't see any # 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. # evidence (on 2021-09-22) that playlists are an actual thing that exists.