[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)
|
||||
page_type = path[1:index]
|
||||
|
||||
# get item name
|
||||
if page_type == "accounts" or page_type == "video-channels":
|
||||
# get item name (between index and index2)
|
||||
if page_type in ["accounts","a"]:
|
||||
# https://example.com/accounts/uuid
|
||||
# https://example.com/a/uuid
|
||||
|
||||
index2 = path.find("/",index+1)
|
||||
elif page_type == "videos":
|
||||
# assume UUID is last thing in URL after cleaning additional args
|
||||
# end index is -1 in case of trailing slash
|
||||
name = path[path.rindex("/",0,-1):]
|
||||
if path.startswith("/videos/watch/playlist/"):
|
||||
page_type = "accounts"
|
||||
|
||||
elif page_type in ["video-channels","c"]:
|
||||
# https://example.com/video-channels/uuid
|
||||
# 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)
|
||||
return
|
||||
|
||||
elif path.startswith("/w/"):
|
||||
# https://example.com/w/uuid
|
||||
|
||||
index2 = path.find("/",index+1)
|
||||
page_type = "videos"
|
||||
|
||||
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)
|
||||
index2 = path.find("/",index+2)
|
||||
|
||||
else:
|
||||
notify ("Unrecognized URL format.", verbosity, platform)
|
||||
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
|
||||
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