~cadence/tube-devel

Support /watch/, /shorts/, /v/, /w/ redirection v1 SUPERSEDED

bopol
bopol: 1
 Support /watch/, /shorts/, /v/, /w/ redirection

 1 files changed, 5 insertions(+), 0 deletions(-)
bopol
I looked at youtube-dl's code and noticed I missed /e/

https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/extractor/youtube.py#L382
/e/ redirects implemented.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~cadence/tube-devel/patches/20314/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Support /watch/, /shorts/, /v/, /w/ redirection Export this patch

bopol
---
 api/redirects.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/api/redirects.js b/api/redirects.js
index e940798..2b1880e 100644
--- a/api/redirects.js
+++ b/api/redirects.js
@@ -16,5 +16,10 @@ module.exports = [
			*/
			return redirect(`/watch?v=${fill[0]}${url.search.replace(/^\?/, "&")}`, 301)
		}
	},
	{
		route: `/(watch|w|v|shorts)/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => {
			return redirect(`/watch?v=${fill[1]}${url.search.replace(/^\?/, "&")}`, 301)
		}
	}
]
-- 
2.29.2
Thanks for teaching me that these redirects existed. Implemented using
my own code in commit f24da6c7b0a76615f8724689500916c0ae3f0f16.