[peertube] Support newer URL format.
This commit is contained in:
parent
e577e50fd9
commit
12be2714b6
|
@ -24,20 +24,47 @@ def extract_from_page (page, verbosity, url, args):
|
||||||
index = path.find("/",1)
|
index = path.find("/",1)
|
||||||
page_type = path[1:index]
|
page_type = path[1:index]
|
||||||
|
|
||||||
# get item name
|
# get item name (between index and index2)
|
||||||
if page_type == "accounts" or page_type == "video-channels":
|
if page_type in ["accounts","a"]:
|
||||||
|
# https://example.com/accounts/uuid
|
||||||
|
# https://example.com/a/uuid
|
||||||
|
|
||||||
index2 = path.find("/",index+1)
|
index2 = path.find("/",index+1)
|
||||||
elif page_type == "videos":
|
page_type = "accounts"
|
||||||
# assume UUID is last thing in URL after cleaning additional args
|
|
||||||
# end index is -1 in case of trailing slash
|
elif page_type in ["video-channels","c"]:
|
||||||
name = path[path.rindex("/",0,-1):]
|
# https://example.com/video-channels/uuid
|
||||||
if path.startswith("/videos/watch/playlist/"):
|
# https://example.com/c/uuid
|
||||||
|
|
||||||
|
index2 = path.find("/",index+1)
|
||||||
|
page_type = "video-channels"
|
||||||
|
|
||||||
|
elif page_type in ["videos","w"]:
|
||||||
|
# https://example.com/videos/watch/uuid
|
||||||
|
# https://example.com/videos/watch/playlist/uuid
|
||||||
|
# https://example.com/w/uuid
|
||||||
|
# https://example.com/w/p/uuid
|
||||||
|
|
||||||
|
if path.startswith("/videos/watch/playlist/") or path.startswith("/w/p/"):
|
||||||
|
# https://example.com/videos/watch/playlist/uuid
|
||||||
|
# https://example.com/w/p/uuid
|
||||||
|
|
||||||
|
page_type = "playlist"
|
||||||
notify ("PeerTube playlists don't seem to have API pages", verbosity, platform)
|
notify ("PeerTube playlists don't seem to have API pages", verbosity, platform)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif path.startswith("/w/"):
|
||||||
|
# https://example.com/w/uuid
|
||||||
|
|
||||||
|
index2 = path.find("/",index+1)
|
||||||
|
page_type = "videos"
|
||||||
|
|
||||||
elif path.startswith("/videos/watch/"):
|
elif path.startswith("/videos/watch/"):
|
||||||
# format is like https://example.com/videos/watch/uuid
|
# https://example.com/videos/watch/uuid
|
||||||
|
|
||||||
index = path.find("/",index+1)
|
index = path.find("/",index+1)
|
||||||
index2 = path.find("/",index+2)
|
index2 = path.find("/",index+2)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
notify ("Unrecognized URL format.", verbosity, platform)
|
notify ("Unrecognized URL format.", verbosity, platform)
|
||||||
return
|
return
|
||||||
|
|
|
@ -21,3 +21,15 @@ https://share.tube/video-channels/blender_open_movies@video.blender.org/videos h
|
||||||
|
|
||||||
# video on another instance -> canonical instance channel RSS
|
# video on another instance -> canonical instance channel RSS
|
||||||
https://share.tube/videos/watch/3d95fb3d-c866-42c8-9db1-fe82f48ccb95 https://video.blender.org/feeds/videos.xml?videoChannelId=9
|
https://share.tube/videos/watch/3d95fb3d-c866-42c8-9db1-fe82f48ccb95 https://video.blender.org/feeds/videos.xml?videoChannelId=9
|
||||||
|
|
||||||
|
### new format
|
||||||
|
# account page
|
||||||
|
https://peertube.negativezero.link/a/0x80/video-channels https://peertube.negativezero.link/feeds/videos.xml?accountId=3
|
||||||
|
https://peertube.negativezero.link/a/0x80 https://peertube.negativezero.link/feeds/videos.xml?accountId=3
|
||||||
|
|
||||||
|
# channel page
|
||||||
|
https://peertube.negativezero.link/c/0x80_tech/videos https://peertube.negativezero.link/feeds/videos.xml?videoChannelId=2
|
||||||
|
https://peertube.negativezero.link/c/0x80_tech https://peertube.negativezero.link/feeds/videos.xml?videoChannelId=2
|
||||||
|
|
||||||
|
# video page
|
||||||
|
https://peertube.negativezero.link/w/prJKsQDXYzGcQCsaittFP2 https://peertube.negativezero.link/feeds/videos.xml?videoChannelId=2
|
||||||
|
|
Loading…
Reference in New Issue