Add odysee support.

Currently, the LBRY support is limited to odysee.
This is because I only know of that instance.
This commit is contained in:
lost 2021-09-22 00:00:00 +00:00
parent 3dde349ea9
commit fdd1c9d09a
3 changed files with 46 additions and 0 deletions

View File

@ -16,6 +16,8 @@ supported_sites = {
"github" : ["github.com"],
"lbry" : ["odysee.com"],
"player_fm" : ["player.fm/series/"],
"pocketcasts" : ["pca.st"],

View File

@ -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

13
tests/lbry.txt Normal file
View File

@ -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.