Fix personal-script load after javascript loading from the DOM, reported by a Trisquel user in Abrowser.
52 lines
1.9 KiB
JavaScript
52 lines
1.9 KiB
JavaScript
// ==UserScript==
|
|
// @name Invidious - Proxy Mode
|
|
// @version 0.1.4
|
|
// @author Jesús E.
|
|
// @license GPL-3.0
|
|
// @description This script automatically Proxy-Mode on Invidious and its various public instances.
|
|
// @namespace InvidiousProxy
|
|
// @homepageURL https://libregit.org/heckyel/book/src/branch/master/scripts-greasemonkey
|
|
// @include /^http(s|)://(www[.]|)invidio[.]us/.*$/
|
|
// @include /^http(s|)://(www[.]|proxy[.]|)invidious[.]snopyta[.]org/.*$/
|
|
// @include /^http(s|)://(www[.]|)vid[.]wxzm[.]sx/.*$/
|
|
// @include /^http(s|)://(www[.]|)invidious[.]kabi[.]tk/.*$/
|
|
// @include /^http(s|)://(www[.]|)invidiou[.]sh/*
|
|
// @include /^http(s|)://(www[.]|)invidious[.]enkirton[.]net/.*$/
|
|
// @include /^http(s|)://(www[.]|)tube[.]poal[.]co/.*$/
|
|
// @include /^http(s|)://(www[.]|)invidious[.]13ad[.]de/.*$/
|
|
// @include /^http(s|)://(www[.]|)invidious[.]drycat[.]fr/.*$/
|
|
// @grant none
|
|
// ==/UserScript==
|
|
|
|
function proxyMode() {
|
|
const consoleCSS = 'background: #000; color: #00FF00; padding: 0px 7px; border: 1px solid #00FF00; line-height: 16px;';
|
|
|
|
// Set variables
|
|
let i, j, url;
|
|
let vids_tags = ["video", "source"];
|
|
let vids_elements, proxyURL;
|
|
|
|
// Regex
|
|
let params=new RegExp(/itag=(18|22|43)$/);
|
|
|
|
for (i = 0; i < vids_tags.length; i++) {
|
|
vids_elements = document.getElementsByTagName(vids_tags[i]);
|
|
for (j = 0; j < vids_elements.length; j++) {
|
|
url = vids_elements.item(j).src;
|
|
if(params.test(url)) {
|
|
proxyURL = url + "&local=true";
|
|
vids_elements.item(j).src = proxyURL;
|
|
} else {
|
|
console.log('Live URL or format M3U8');
|
|
}
|
|
}
|
|
}
|
|
console.log("%cUSERSCRIPT | " + GM_info.script.name + " " + GM_info.script.version + " | successfully initialized", consoleCSS);
|
|
}
|
|
proxyMode();
|
|
|
|
// Fix Abrowser
|
|
window.addEventListener('load', () => {
|
|
proxyMode();
|
|
});
|