Add support for funkwhale channels.
This commit is contained in:
parent
bb4a20e2d2
commit
266d94d2df
|
@ -7,6 +7,10 @@ supported_software = {
|
||||||
'<meta property="og:site_name" content="Bibliogram">',
|
'<meta property="og:site_name" content="Bibliogram">',
|
||||||
'<section class="bibliogram-meta">'
|
'<section class="bibliogram-meta">'
|
||||||
],
|
],
|
||||||
|
"funkwhale" : [
|
||||||
|
'<meta name=generator content=Funkwhale>',
|
||||||
|
"<noscript><strong>We're sorry but Funkwhale doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>"
|
||||||
|
],
|
||||||
"peertube" : [
|
"peertube" : [
|
||||||
'<meta property="og:platform" content="PeerTube"'
|
'<meta property="og:platform" content="PeerTube"'
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
from utils import *
|
||||||
|
|
||||||
|
# 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
|
||||||
|
slash1 = url.find("/",url.find("//")+2)
|
||||||
|
domain = url[:slash1]
|
||||||
|
path = url[slash1:]
|
||||||
|
|
||||||
|
# get page type
|
||||||
|
slash2 = path.find("/",1)
|
||||||
|
if slash2 > 0:
|
||||||
|
page_type = path[1:slash2]
|
||||||
|
else:
|
||||||
|
page_type = path[1:]
|
||||||
|
|
||||||
|
if page_type == "channels":
|
||||||
|
slash3 = path.find("/",slash2 + 1)
|
||||||
|
if slash3 > 0:
|
||||||
|
channel_name = path[slash2+1:slash3]
|
||||||
|
else:
|
||||||
|
channel_name = path[slash2+1:]
|
||||||
|
|
||||||
|
# use home instance
|
||||||
|
if '@' in channel_name:
|
||||||
|
# TODO: how do we handle protocol (http vs. https)?
|
||||||
|
# for now, assume it's the same as url, or https if not specified
|
||||||
|
if "//" in domain:
|
||||||
|
protocol = domain[:domain.index("//")+2]
|
||||||
|
else:
|
||||||
|
protocol = "https://"
|
||||||
|
debug ("Assuming " + protocol + " for remote instance", verbosity, platform)
|
||||||
|
at_index = channel_name.find("@")
|
||||||
|
domain = protocol + channel_name[at_index+1:]
|
||||||
|
channel_name = channel_name[:at_index]
|
||||||
|
|
||||||
|
if channel_name != "":
|
||||||
|
return domain + "/api/v1/channels/" + channel_name + "/rss"
|
||||||
|
|
||||||
|
def extract (url, page=None, network=False, verbosity=3, args={}):
|
||||||
|
feed = extract_from_url (url, verbosity)
|
||||||
|
if not feed is None:
|
||||||
|
return feed
|
|
@ -0,0 +1,3 @@
|
||||||
|
https://funkwhale.it/channels/ilpunto/ https://funkwhale.it/api/v1/channels/ilpunto/rss
|
||||||
|
https://funkwhale.thurk.org/channels/radio_colibri@open.audio/ https://open.audio/api/v1/channels/radio_colibri/rss
|
||||||
|
https://open.audio/channels/radio_colibri https://open.audio/api/v1/channels/radio_colibri/rss
|
Loading…
Reference in New Issue