mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2024-11-25 11:52:52 +01:00
parent
6be4c53130
commit
3d2883ea9e
@ -2,6 +2,8 @@
|
||||
|
||||
This repo aims to provide multiple solutions for blocking Twitch ads.
|
||||
|
||||
**Don't combine Twitch specific ad blockers.**
|
||||
|
||||
## Recommendations
|
||||
|
||||
Proxies are the most reliable way of avoiding ads ([buffering / downtime info](full-list.md#proxy-issues)).
|
||||
@ -22,10 +24,9 @@ Alternatively:
|
||||
|
||||
**There are better / easier to use methods in the above** `Recommendations`.
|
||||
|
||||
*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.
|
||||
- *Enabled by default on uBlock Origin 1.38.4*.
|
||||
- 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.
|
||||
- Notifies Twitch that ads were "watched" (reduces preroll ad frequency).
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.11
|
||||
// @version 1.12
|
||||
// @description Multiple solutions for blocking Twitch ads
|
||||
// @author pixeltris
|
||||
// @match *://*.twitch.tv/*
|
||||
@ -492,14 +492,7 @@
|
||||
var realFetch = window.fetch;
|
||||
window.fetch = function(url, init, ...args) {
|
||||
if (typeof url === 'string') {
|
||||
if (url.includes('/access_token') || url.includes('gql')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
if (url.includes('gql') && init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
}
|
||||
if (url.includes('gql')) {
|
||||
var deviceId = init.headers['X-Device-Id'];
|
||||
if (typeof deviceId !== 'string') {
|
||||
deviceId = init.headers['Device-ID'];
|
||||
@ -513,12 +506,19 @@
|
||||
value: gql_device_id
|
||||
});
|
||||
}
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
if (typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,12 @@ twitch-videoad.js application/javascript
|
||||
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';
|
||||
}
|
||||
if (typeof url === 'string' && url.includes('gql') && typeof init.body == 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
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);
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (bypass)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.0
|
||||
// @version 1.1
|
||||
// @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)
|
||||
@ -15,14 +15,12 @@
|
||||
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';
|
||||
}
|
||||
if (typeof url === 'string' && url.includes('gql') && typeof init.body == 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
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);
|
||||
|
@ -483,14 +483,7 @@ twitch-videoad.js application/javascript
|
||||
var realFetch = window.fetch;
|
||||
window.fetch = function(url, init, ...args) {
|
||||
if (typeof url === 'string') {
|
||||
if (url.includes('/access_token') || url.includes('gql')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
if (url.includes('gql') && init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
}
|
||||
if (url.includes('gql')) {
|
||||
var deviceId = init.headers['X-Device-Id'];
|
||||
if (typeof deviceId !== 'string') {
|
||||
deviceId = init.headers['Device-ID'];
|
||||
@ -504,12 +497,19 @@ twitch-videoad.js application/javascript
|
||||
value: gql_device_id
|
||||
});
|
||||
}
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
if (typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (notify-reload)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.11
|
||||
// @version 1.12
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
|
||||
// @description Multiple solutions for blocking Twitch ads (notify-reload)
|
||||
@ -494,14 +494,7 @@
|
||||
var realFetch = window.fetch;
|
||||
window.fetch = function(url, init, ...args) {
|
||||
if (typeof url === 'string') {
|
||||
if (url.includes('/access_token') || url.includes('gql')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
if (url.includes('gql') && init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
}
|
||||
if (url.includes('gql')) {
|
||||
var deviceId = init.headers['X-Device-Id'];
|
||||
if (typeof deviceId !== 'string') {
|
||||
deviceId = init.headers['Device-ID'];
|
||||
@ -515,12 +508,19 @@
|
||||
value: gql_device_id
|
||||
});
|
||||
}
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
if (typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -483,14 +483,7 @@ twitch-videoad.js application/javascript
|
||||
var realFetch = window.fetch;
|
||||
window.fetch = function(url, init, ...args) {
|
||||
if (typeof url === 'string') {
|
||||
if (url.includes('/access_token') || url.includes('gql')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
if (url.includes('gql') && init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
}
|
||||
if (url.includes('gql')) {
|
||||
var deviceId = init.headers['X-Device-Id'];
|
||||
if (typeof deviceId !== 'string') {
|
||||
deviceId = init.headers['Device-ID'];
|
||||
@ -504,12 +497,19 @@ twitch-videoad.js application/javascript
|
||||
value: gql_device_id
|
||||
});
|
||||
}
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
if (typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (notify-strip)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.11
|
||||
// @version 1.12
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
|
||||
// @description Multiple solutions for blocking Twitch ads (notify-strip)
|
||||
@ -494,14 +494,7 @@
|
||||
var realFetch = window.fetch;
|
||||
window.fetch = function(url, init, ...args) {
|
||||
if (typeof url === 'string') {
|
||||
if (url.includes('/access_token') || url.includes('gql')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
if (url.includes('gql') && init && typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
}
|
||||
if (url.includes('gql')) {
|
||||
var deviceId = init.headers['X-Device-Id'];
|
||||
if (typeof deviceId !== 'string') {
|
||||
deviceId = init.headers['Device-ID'];
|
||||
@ -515,12 +508,19 @@
|
||||
value: gql_device_id
|
||||
});
|
||||
}
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
if (typeof init.body === 'string' && init.body.includes('PlaybackAccessToken')) {
|
||||
if (OPT_ACCESS_TOKEN_PLAYER_TYPE) {
|
||||
const newBody = JSON.parse(init.body);
|
||||
newBody.variables.playerType = OPT_ACCESS_TOKEN_PLAYER_TYPE;
|
||||
init.body = JSON.stringify(newBody);
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
if (OPT_ROLLING_DEVICE_ID) {
|
||||
if (typeof init.headers['X-Device-Id'] === 'string') {
|
||||
init.headers['X-Device-Id'] = gql_device_id_rolling;
|
||||
}
|
||||
if (typeof init.headers['Device-ID'] === 'string') {
|
||||
init.headers['Device-ID'] = gql_device_id_rolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user