Greasy Fork is available in English.

Перенаправление yt3.ggpht.com на yt4.ggpht.com (YouTube Avatars Fix)

Перенаправляет запросы с yt3.ggpht.com на yt4.ggpht.com для получения доступа к аватарам.

// ==UserScript==
// @name        Redirect yt3.ggpht.com to yt4.ggpht.com (YouTube Avatars Fix)
// @name:ru     Перенаправление yt3.ggpht.com на yt4.ggpht.com (YouTube Avatars Fix)
// @description Redirects requests from yt3.ggpht.com to yt4.ggpht.com to access avatars.
// @description:ru Перенаправляет запросы с yt3.ggpht.com на yt4.ggpht.com для получения доступа к аватарам.
// @namespace   tampermonkey-yt3-to-yt4-redirect
// @version     1.0.5
// @match       *://*.youtube.com/*
// @grant       none
// @license     MIT
// ==/UserScript==

(function() {
  'use strict';

  // Function to replace yt3.ggpht.com with yt4.ggpht.com in URLs
  function redirectURL(url) {
    return url.replace(/^https?:\/\/(yt3\.)?ggpht\.com/, 'https://yt4.ggpht.com');
  }

  // RequestListener
  function requestListener(details) {
    if (details.url.startsWith('https://yt3.ggpht.com/ytc/')) {
      return { redirectUrl: redirectURL(details.url) }
    } else if (details.url.startsWith('https://yt3.ggpht.com/')) {
      return { redirectUrl: redirectURL(details.url) }
    }
  }

  // Adding a request listener
  chrome.webRequest.onBeforeRequest.addListener(
    RequestListener,
    { urls: ['<all_urls>'] }
    ['blocking']
  );
})();