Greasy Fork is available in English.

Redirect YouTube Shorts to Watch

Redirect /shorts to /watch

作者
𝖢𝖸 𝖥𝗎𝗇𝗀
今日安裝
0
安裝總數
189
評價
0 1 0
版本
0.1.3
建立日期
2023-06-10
更新日期
2023-06-16
授權條款
MIT
腳本執行於

Redirect YouTube Shorts to Watch

development request #187353

Description

The Redirect YouTube Shorts to Watch userscript is a tool designed to automatically redirect URLs with the "/shorts" path on YouTube to the corresponding "/watch" page. This userscript is intended to enhance the user experience by ensuring that when a user visits a YouTube Shorts video, they are automatically redirected to the standard video watch page.

How it Works

The userscript utilizes the popular browser extension Tampermonkey to run custom JavaScript code whenever a YouTube page is loaded. The code checks the URL of the page and detects if it contains the "/shorts" path. If a "/shorts" path is found, the userscript extracts the video ID from the URL and redirects the user to the corresponding "/watch?v=" URL.

The userscript listens for various events triggered during page navigation and updates, ensuring that the redirection functionality remains active and reacts to changes in the URL. It utilizes event listeners for events such as "yt-navigate," "yt-navigate-start," "yt-page-data-fetched," "yt-page-data-updated," and "yt-navigate-finish" to continuously monitor the page and perform the necessary redirection when required.

By automatically redirecting YouTube Shorts URLs to the watch page, this userscript eliminates the need for users to manually change the URL or search for the video they want to watch. It provides a seamless and efficient browsing experience for users who prefer to watch YouTube videos on the standard watch page rather than the Shorts format.

Please note that this userscript requires a browser extension like Tampermonkey to be installed and enabled in your browser. The installation process may vary depending on your browser and extension manager.