123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // ==UserScript==
- // @name Invidious - Proxy Mode
- // @version 0.1.9
- // @author Jesús E.
- // @license GPL version 3 or any later version::: https://www.gnu.org/licenses/gpl-3.0.html
- // @description This script automatically Proxy-Mode on Invidious and its various public instances.
- // @namespace InvidiousProxy
- // @homepageURL https://git.sr.ht/~heckyel/book/blob/master/scripts-greasemonkey
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidio[.]us)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|proxy[.]|)(?:invidious[.]snopyta[.]org)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:vid[.]wxzm[.]sx)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidious[.]kabi[.]tk)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidiou[.]sh)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:yewtu[.]be)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidious[.]ggc-project[.]de)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidious[.]enkirton[.]net)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:tube[.]poal[.]co)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidious[.]13ad[.]de)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @include /(?:(?:http(s|):\/\/)(www[.]|)(?:invidious[.]drycat[.]fr)\/(watch\?v=|embed\/))([^= &?(\/)\r\n]{8,11})(\S+)?$/
- // @grant none
- // ==/UserScript==
- function proxyMode() {
- const consoleCSS = 'background: #000; color: #00FF00; padding: 0px 7px; border: 1px solid #00FF00; line-height: 16px;';
- const name = GM_info.script.name;
- const version = GM_info.script.version;
- const log = (...args) => console.log('%cUSERSCRIPT | %s %s | %s', consoleCSS, name, version, ...args);
- // 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('Proxy was already applied or Live URL');
- }
- }
- }
- log('successfully initialized');
- }
- proxyMode();
- // Fix Abrowser
- window.addEventListener('load', () => {
- proxyMode();
- });
|