From 038036722e377b75200210cb81efc8b341dbc84a Mon Sep 17 00:00:00 2001 From: MintMain21 <91362684+MintMain21@users.noreply.github.com> Date: Fri, 7 Apr 2023 14:27:37 -0700 Subject: [PATCH] Reformatting Changes to Redirector Documentation (#367) * Minor change to URL Parameter Documentation URL. * Reformated Redirection Rules in plaintext to avoid unintentional tranlation errors into Markdown. * I think I did the formatting right. Also... I added an additional rule for redirecting Invidious URLs that aren't video players, so that it's easier to enforce sitewide preferences like theme and language. --- docs/redirector-setup.md | 98 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/docs/redirector-setup.md b/docs/redirector-setup.md index 27f29a4..789753e 100644 --- a/docs/redirector-setup.md +++ b/docs/redirector-setup.md @@ -12,76 +12,77 @@ For basic redirects, you will need the following rules set up. # Rule 1 (Redirect Video URLs) -Redirects Youtube Videos to Invidious -Redirect: https://*.youtube.com/watch?*v=* -to: https://[Invidious Domain Here]/watch?$2v=$3 -Hint: Redirects individual videos to their Invidious equivelant -Example: https://www.youtube.com/watch?v=Lz13cxZNTCo → https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo -Applies to: Main window (address bar) +Redirect ```https://*youtube.com/watch?*v=*``` + to: ```https://[Invidious Domain Here]/watch?$2v=$3``` + Example: ```https://www.youtube.com/watch?v=Lz13cxZNTCo``` → https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo + Applies to: Main window (address bar) # Rule 2 (Redirects the youtu.be domain, typically accociated with URLs generated by the "Share" button) -Redirect: https://youtu.be/* -to: https://[Invidious Domain Here]/watch?v=$1 -Example: https://youtu.be/Ae5yV4p7uh8?t=35 → https://[Invidious Domain Here]/watch?v=Ae5yV4p7uh8?t=35 +Redirect: ```https://youtu.be/*``` +to: ```https://[Invidious Domain Here]/watch?v=$1``` +Example: ```https://youtu.be/Ae5yV4p7uh8?t=35``` → https://[Invidious Domain Here]/watch?v=Ae5yV4p7uh8?t=35 +Applies to: Main window (address bar) # Rule 3 (Redirects Search Results, useful for those who use DDG bangs or search extensions to search YouTube and would like those properly redirected to Invidious) -Redirect YouTube Search to Invidious -Redirect: https://www.youtube.com/results?search_query=*&page -to: https://[Invidious Domain Here]/search?q=$1 -Example: https://www.youtube.com/results?search_query=Smash+Bros+Trailer&page → https://[Invidious Domain Here]/search?q=Smash+Bros+Trailer +Redirect: ```https://www.youtube.com/results?search_query=*&page``` +to: ```https://[Invidious Domain Here]/search?q=$1``` +Example: ```https://www.youtube.com/results?search_query=Smash+Bros+Trailer&page``` → https://[Invidious Domain Here]/search?q=Smash+Bros+Trailer Applies to: Main window (address bar) # Rule 4 (Redirects the YouTube Domain itself, IE: channel pages and the homepage) -Redirects Youtube to Invidous -Redirect: https://*.youtube.com/* -to: https://[Invidious Domain Here]/$2 -Example: https://www.youtube.com/channel/UCOkL7q2SeGZeZuj22njMYEA → https://[Invidious Domain Here]/channel/UCOkL7q2SeGZeZuj22njMYEA +Redirect: ```https://*.youtube.com/*``` +to: ```https://[Invidious Domain Here]/$2``` +Example: ```https://www.youtube.com/channel/UCOkL7q2SeGZeZuj22njMYEA``` → https://[Invidious Domain Here]/channel/UCOkL7q2SeGZeZuj22njMYEA Applies to: Main window (address bar) # How to use it for Invidious URL Parameters? -If you would like to use URL Parameters in your redirects (see https://github.com/cloudrac3r/invidious-documentation/blob/master/List-of-URL-parameters.md), you will need to manually add them to Rule 1, (https://[Invidious Domain Here]/watch?v=$1[URL Parameters here] in place of https://[Invidious Domain Here]/watch?v=$1. +If you would like to use URL Parameters in your redirects (see [here](https://github.com/cloudrac3r/invidious-documentation/blob/master/List-of-URL-parameters.md)), you will need to manually add them to the preceding rules (https://[Invidious Domain Here]/watch?v=$1[URL Parameters here] in place of https://[Invidious Domain Here]/watch?v=$1). -For clarity, an example of a URL parameter would be &related_videos=false&comments=false to ensure that neither related videos nor comments are displayed on a video page, so https://[Invidious Domain Here]/watch?v=$1&related_videos=false&comments=false would be the destination of redirects. +For clarity, an example of a URL parameter would be &related_videos=false&comments=false to ensure that neither related videos nor comments are displayed on a video page, so ```https://[Invidious Domain Here]/watch?v=$1&related_videos=false&comments=false``` would be the destination of redirects. -Should you choose to use URL Parameters, I would reccomend adding the following rule to both ensure all invidious videos load with your preference, and to ensure that unnecesary parameters are not added when already applied. +For redirects with ? in the URL, the Parameter string will start with &, while redirects without ? in the URL should have a Parameter string begining with ?, so https://[Invidious Domain Here]/$2 becomes ```https://[Invidious Domain Here]/$2?related_videos=false&comments=false``` + +Should you choose to use URL Parameters, I would reccomend adding the following rules to both ensure all invidious videos load with your preference, and to ensure that unnecesary parameters are not added when already applied. # Rule 5 (Redirects Invidious Video URLs with parameters) -Redirects Invidious Videos with URL Parameters -Redirect: https://[Invidious Domain Here]/watch?v=* -to: https://[Invidious Domain Here]/watch?v=$1[URL Parameters here] -excluding: https://[Invidious Domain Here]/watch?v=*[URL Parameters here] -Hint: Update this to correlate with the YouTube Video Redirect -Example: https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo → https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo[URL Parameters here] +Redirect: ```https://[Invidious Domain Here]/watch?v=*``` +to: ```https://[Invidious Domain Here]/watch?v=$1[URL Parameters here]``` +excluding: ```https://[Invidious Domain Here]/watch?v=*[URL Parameters here]``` +Example: ```https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo``` → https://[Invidious Domain Here]/watch?v=Lz13cxZNTCo[URL Parameters here] Applies to: Main window (address bar) -It is important that you add the exception so as not to create infinite repeats of the same URL Parameters when opening multiple Invidious Videos in a single session. When creating or editing rules in Redirector you must access "Advanced Options" in order to set exceptions. +# Rule 6 (Redirects Invidious Domain URLs with parameters) + +Redirect: ```https://[Invidious Domain Here]/*``` +to: ```https://[Invidious Domain Here]/$1[URL Parameters here]``` +excluding: ```https://[Invidious Domain Here]/*[URL Parameters here]``` +Example: ```https://[Invidious Domain Here]/``` → https://[Invidious Domain Here]/[URL Parameters here] +Applies to: Main window (address bar) + +It is important that you add the exceptions so as not to create infinite repeats of the same URL Parameters when opening multiple Invidious Videos in a single session. When creating or editing rules in Redirector you must access "Advanced Options" in order to set exceptions. # How to use it for Redirecting Embeds? For redirecting embeds, you'll need the following two rules. (Note, it is imparative that you check these two roles apply to both the Main Window and IFrames, otherwise the rule won't apply to Embeds). -# Rule 6 (For redirecting standard embed links) +# Rule 7 (For redirecting standard embed links) -Redirects Embedded Youtube Videos to Invidious -Redirect: https://www.youtube.com/embed/* -to: https://[Invidious Domain Here]/embed/$1 -Hint: Redirects individual videos to their Invidious equivelant -Example: https://www.youtube.com/embed/Lz13cxZNTCo → https://[Invidious Domain Here]/embed/Lz13cxZNTCo +Redirect: ```https://www.youtube.com/embed/*``` +to: ```https://[Invidious Domain Here]/embed/$1``` +Example: ```https://www.youtube.com/embed/Lz13cxZNTCo``` → https://[Invidious Domain Here]/embed/Lz13cxZNTCo Applies to: Main window (address bar), IFrames -# Rule 7 (For redirecting nocookie embeds) +# Rule 8 (For redirecting nocookie embeds) -Redirects Embedded Youtube Videos to Invidious -Redirect: https://www.youtube-nocookie.com/embed/* -to: https://[Invidious Domain Here]/embed/$1 -Hint: Redirects individual videos to their Invidious equivelant -Example: https://www.youtube-nocookie.com/embed/Lz13cxZNTCo → https://[Invidious Domain Here]/embed/Lz13cxZNTCo +Redirect: ```https://www.youtube-nocookie.com/embed/*``` +to: ```https://[Invidious Domain Here]/embed/$1``` +Example: ```https://www.youtube-nocookie.com/embed/Lz13cxZNTCo``` → https://[Invidious Domain Here]/embed/Lz13cxZNTCo Applies to: Main window (address bar), IFrames @@ -90,21 +91,18 @@ Applies to: Main window (address bar), IFrames Finally, if you like to subscribe to channels using RSS feeds, the following two rules will redirect Invidious RSS feeds to their YouTube equivelants. This way you'll still have access to your feeds should you need to migrate to another instance. -# Rule 8 (For redirecting channel feeds) +# Rule 9 (For redirecting channel feeds) -Redirect Invidious Feeds to YouTube Feeds -Redirect: https://[Invidious Domain Here]/feed/channel/* -to: https://www.youtube.com/feeds/videos.xml?channel_id=$1 -Hint: And now you can subscribe in peace. -Example: https://[Invidious Domain Here]/feed/channel/UCOkL7q2SeGZeZuj22njMYEA → https://www.youtube.com/feeds/videos.xml?channel_id=UCOkL7q2SeGZeZuj22njMYEA +Redirect: ```https://[Invidious Domain Here]/feed/channel/*``` +to: ```https://www.youtube.com/feeds/videos.xml?channel_id=$1``` +Example: ```https://[Invidious Domain Here]/feed/channel/UCOkL7q2SeGZeZuj22njMYEA``` → https://www.youtube.com/feeds/videos.xml?channel_id=UCOkL7q2SeGZeZuj22njMYEA Applies to: Main window (address bar) -# Rule 9 (For redirecting playlist feeds) +# Rule 10 (For redirecting playlist feeds) -Redirect Playlist RSS from Invidious to YouTube -Redirect: https://[Invidious Domain Here]/feed/playlist/* -to: https://www.youtube.com/feeds/videos.xml?playlist_id=$1 -Example: https://[Invidious Domain Here]/feed/playlist/PLY_6uAtgkYXl1sPyzNa2UFQYgPj2qA-qj → https://www.youtube.com/feeds/videos.xml?playlist_id=PLY_6uAtgkYXl1sPyzNa2UFQYgPj2qA-qj +Redirect: ```https://[Invidious Domain Here]/feed/playlist/*``` +to: ```https://www.youtube.com/feeds/videos.xml?playlist_id=$1``` +Example: ```https://[Invidious Domain Here]/feed/playlist/PLY_6uAtgkYXl1sPyzNa2UFQYgPj2qA-qj``` → https://www.youtube.com/feeds/videos.xml?playlist_id=PLY_6uAtgkYXl1sPyzNa2UFQYgPj2qA-qj Applies to: Main window (address bar)