From fdd1c9d09ac9ee5884cd2a840d46000be762fc16 Mon Sep 17 00:00:00 2001 From: lost Date: Wed, 22 Sep 2021 00:00:00 +0000 Subject: [PATCH] Add odysee support. Currently, the LBRY support is limited to odysee. This is because I only know of that instance. --- scripts/determine_site.py | 2 ++ scripts/extractors/lbry.py | 31 +++++++++++++++++++++++++++++++ tests/lbry.txt | 13 +++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 scripts/extractors/lbry.py create mode 100644 tests/lbry.txt diff --git a/scripts/determine_site.py b/scripts/determine_site.py index 83af2aa..849cd2c 100644 --- a/scripts/determine_site.py +++ b/scripts/determine_site.py @@ -16,6 +16,8 @@ supported_sites = { "github" : ["github.com"], + "lbry" : ["odysee.com"], + "player_fm" : ["player.fm/series/"], "pocketcasts" : ["pca.st"], diff --git a/scripts/extractors/lbry.py b/scripts/extractors/lbry.py new file mode 100644 index 0000000..23d4a9d --- /dev/null +++ b/scripts/extractors/lbry.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 + +from utils import * +from download_page import download + +# portable code to get filename +import os +platform = os.path.basename(__file__) +if platform.endswith(".py"): + platform = platform[:(-3)] + +def extract_from_url (url, verbosity): + # split into domain and path + index = url.find("/",url.find("//")+2) + domain = url[:index] + path = url[index:] + + # get username + index = path.find("/",2) + if index > -1: + username = username = path[1:index] + else: + username = path[1:] + + if len(username) > 0 and username[0] == "@": + return domain + "/$/rss/" + username + +def extract (url, page=None, network=False, verbosity=3, args={}): + feed = extract_from_url (url, verbosity) + if not feed is None: + return feed diff --git a/tests/lbry.txt b/tests/lbry.txt new file mode 100644 index 0000000..c701858 --- /dev/null +++ b/tests/lbry.txt @@ -0,0 +1,13 @@ +# channel page +https://odysee.com/@techlore:3 https://odysee.com/$/rss/@techlore:3 +https://odysee.com/@Coldfusion:f https://odysee.com/$/rss/@Coldfusion:f + +# video page +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 + +# 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. +# If/when they get fully implemented and/or people start using them, I'll +# have to add them.