tumpio/requestcontrol

Internal links (single page navigation) not being processed on YouTube

Crul opened this issue · 1 comments

Crul commented

Expected behavior

The rule pasted below should redirect to the VIDEOS tab of a YouTube channel, and it woirks when "Ópen in a new tab" but not on "internal YouTube navigation". Note that the option for "Types" is "Any type" (I know some single page apps are tricky in this regard).

{
  "uuid": "3f24c26e-c0cf-49f0-891b-e47cb6064174",
  "pattern": {
    "scheme": "*",
    "host": [ "www.youtube.com", "youtube.com" ],
    "path": [ "*" ],
    "includes": [ "/.*\\/(c|channel|user)\\/[^\\?\\/]+(\\?.*)?$/" ],
    "excludes": [ "?nr" ]
  },
  "action": "redirect",
  "active": true,
  "title": "%7Bc%7D%20YouTube%20channel%20landing%20page%20to%20video%20list",
  "redirectUrl": "https://{hostname}{pathname}/videos",
  "description": "https%3A%2F%2Fwww.youtube.com%2Fchannel%2FUCwX8RD5ivBjTm1QHIv7fm_Q%3Fpipas%3D1",
  "redirectDocument": true
}

Actual behavior

You are not redirected to /videos tab when using "internal YouTube navigation". Probably because the data is loaded with an AJAX request and there is no real document.href redirection happening.

Steps to reproduce the problem

  1. (With the rule above installed)
  2. Search a channel in YouTube. Example: Biblaridion
  3. Click on its name:
  4. You are NOT redirected to the VIDEO tab
  5. Go back and click on the channel's name but "Opeining in a new tab"
  6. You are redirected to the VIDEO tab

System specs

Request Conrol Version 1.15.5
Firefox 102.0.1 (64-bit) (with a bunch of addons)
Windows 10

Thanks!

I can confirm this is still/also a problem on FF 105.0.3 on macOS 11.7. I tested on a fresh profile to eliminate possible conflicts, using the following rule:

  {
    "uuid": "5a40542f-29be-44af-b67b-14f7651c93cd",
    "pattern": {
      "scheme": "*",
      "host": [
        "www.youtube.com"
      ],
      "path": [
        "shorts*"
      ]
    },
    "types": [
      "main_frame"
    ],
    "action": "redirect",
    "active": true,
    "title": "YouTube%20Shorts",
    "description": "Redirect%20Shorts%20URLs%20to%20regular%20YouTube%20videos",
    "tag": "ytshorts",
    "redirectUrl": "[pathname={pathname/shorts\\//watch?v=}]"
  }

To test, go to https://www.youtube.com/results?search_query=shorts and click on any of the search results. You would expect to get redirected to the normal version of the selected video, but instead you're taken to the Shorts version. The redirect does work as expected if you open the video in a new tab.