mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2024-11-25 20:02:52 +01:00
Add "bypass" script
This commit is contained in:
parent
8bf35bf03f
commit
6be4c53130
@ -24,6 +24,8 @@ Alternatively:
|
|||||||
|
|
||||||
*Don't combine these scripts with other Twitch specific ad blockers.*
|
*Don't combine these scripts with other Twitch specific ad blockers.*
|
||||||
|
|
||||||
|
- bypass ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/bypass/bypass-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/bypass/bypass.user.js))
|
||||||
|
- No ads.
|
||||||
- notify-strip ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js))
|
- notify-strip ([ublock](https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip-ublock-origin.js) / [userscript](https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js))
|
||||||
- Ad segments are replaced by low resolution stream segments.
|
- Ad segments are replaced by low resolution stream segments.
|
||||||
- Notifies Twitch that ads were "watched" (reduces preroll ad frequency).
|
- Notifies Twitch that ads were "watched" (reduces preroll ad frequency).
|
||||||
|
21
bypass/bypass-ublock-origin.js
Normal file
21
bypass/bypass-ublock-origin.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
twitch-videoad.js application/javascript
|
||||||
|
(function() {
|
||||||
|
if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; }
|
||||||
|
function hookFetch() {
|
||||||
|
var realFetch = window.fetch;
|
||||||
|
window.fetch = function(url, init, ...args) {
|
||||||
|
if (typeof url === 'string') {
|
||||||
|
if (url.includes('gql')) {
|
||||||
|
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||||
|
init.headers['X-Device-Id'] = 'twitch-web-wall-mason';
|
||||||
|
}
|
||||||
|
if (typeof init.headers['Device-ID'] === 'string') {
|
||||||
|
init.headers['Device-ID'] = 'twitch-web-wall-mason';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return realFetch.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookFetch();
|
||||||
|
})();
|
32
bypass/bypass.user.js
Normal file
32
bypass/bypass.user.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name TwitchAdSolutions (bypass)
|
||||||
|
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||||
|
// @version 1.0
|
||||||
|
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/bypass/bypass.user.js
|
||||||
|
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/bypass/bypass.user.js
|
||||||
|
// @description Multiple solutions for blocking Twitch ads (bypass)
|
||||||
|
// @author pixeltris
|
||||||
|
// @match *://*.twitch.tv/*
|
||||||
|
// @run-at document-start
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
function hookFetch() {
|
||||||
|
var realFetch = window.fetch;
|
||||||
|
window.fetch = function(url, init, ...args) {
|
||||||
|
if (typeof url === 'string') {
|
||||||
|
if (url.includes('gql')) {
|
||||||
|
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||||
|
init.headers['X-Device-Id'] = 'twitch-web-wall-mason';
|
||||||
|
}
|
||||||
|
if (typeof init.headers['Device-ID'] === 'string') {
|
||||||
|
init.headers['Device-ID'] = 'twitch-web-wall-mason';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return realFetch.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookFetch();
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user