Discussões » Criação de Solicitações
Fix errors in the script. "Youtube fix". Recover profile pictures blocked by ISP. Redirect yt3.ggpht.com to yt4.ggpht.com
Just use the Redirector extension maybe? How do you even use Chrome API through a userscript?
Just use the Redirector extension maybe? How do you even use Chrome API through a userscript?
Redirector script? Extensions are all big, or often don't work. And I don't want to keep the expansion for the sake of one task. A script can be embedded in another script.
// ==UserScript==
// @name Youtube fix
// namespace
// @description Recover profile pictures blocked by ISP./Восстановить изображения профилей заблокированных провайдером.
// @version 1.1.1
// @match: *://*.ggpht.com/*
// @match *://*.youtube.com/*
// @match https://www.youtube.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(async()=>{
const rule={
id:5414,priority:1,action:{
type:"redirect",redirect:{
regexSubstitution:"https://yt4.ggpht.com/\\1"}},
condition:{regexFilter:"^https://yt3.ggpht.com/(.*)",
resourceTypes:["image"]}},
olds=await chrome.declarativeNetRequest.getDynamicRules();await chrome.declarativeNetRequest.updateDynamicRules({removeRuleIds:olds.map((({id})=>id)),
addRules:[rule]}),
console.log(`Wise Choice Sir, Wise Choice \n ${chrome.runtime.getManifest().version}`)})();
//////// variant ////////
chrome.declarativeNetRequest.updateDynamicRules({
addRules: [{
'id': 1337,
'priority': 1,
'action': {
'type': 'redirect',
'redirect': {
"regexSubstitution": "https://yt4.ggpht.com/\\1"
}
},
'condition': {
"regexFilter": "^https://yt3.ggpht.com/(.*)",
'resourceTypes': [
'csp_report', 'font', 'image', 'main_frame', 'media', 'object', 'other', 'ping', 'script',
'stylesheet', 'sub_frame', 'webbundle', 'websocket', 'webtransport', 'xmlhttprequest'
]
}
}],
removeRuleIds: [1337]
})