mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2025-04-29 22:24:29 +02:00
Possibly fix midroll pause/play issue
This commit is contained in:
parent
ac04e98d61
commit
e476b5d661
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name TwitchAdSolutions
|
// @name TwitchAdSolutions
|
||||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||||
// @version 1.9
|
// @version 1.10
|
||||||
// @description Multiple solutions for blocking Twitch ads
|
// @description Multiple solutions for blocking Twitch ads
|
||||||
// @author pixeltris
|
// @author pixeltris
|
||||||
// @match *://*.twitch.tv/*
|
// @match *://*.twitch.tv/*
|
||||||
@ -148,7 +148,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
streamInfo.HadAds = true;
|
streamInfo.HadAds[url] = true;
|
||||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||||
@ -272,9 +272,9 @@
|
|||||||
streamInfo.BackupUrl = null;
|
streamInfo.BackupUrl = null;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (streamInfo.HadAds) {
|
if (streamInfo.HadAds[url]) {
|
||||||
postMessage({key:'UboPauseResumePlayer'});
|
postMessage({key:'UboPauseResumePlayer'});
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds[url] = false;
|
||||||
}
|
}
|
||||||
postMessage({key:'UboHideAdBanner'});
|
postMessage({key:'UboHideAdBanner'});
|
||||||
return textStr;
|
return textStr;
|
||||||
@ -340,7 +340,7 @@
|
|||||||
streamInfo.BackupRegUrl = null;
|
streamInfo.BackupRegUrl = null;
|
||||||
streamInfo.BackupRegRes = null;
|
streamInfo.BackupRegRes = null;
|
||||||
streamInfo.IsMidroll = false;
|
streamInfo.IsMidroll = false;
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||||
@ -351,6 +351,7 @@
|
|||||||
streamInfo.Urls[lines[i]] = res;
|
streamInfo.Urls[lines[i]] = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
streamInfo.HadAds[lines[i]] = false;
|
||||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ twitch-videoad.js application/javascript
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
streamInfo.HadAds = true;
|
streamInfo.HadAds[url] = true;
|
||||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||||
@ -263,9 +263,9 @@ twitch-videoad.js application/javascript
|
|||||||
streamInfo.BackupUrl = null;
|
streamInfo.BackupUrl = null;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (streamInfo.HadAds) {
|
if (streamInfo.HadAds[url]) {
|
||||||
postMessage({key:'UboPauseResumePlayer'});
|
postMessage({key:'UboPauseResumePlayer'});
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds[url] = false;
|
||||||
}
|
}
|
||||||
postMessage({key:'UboHideAdBanner'});
|
postMessage({key:'UboHideAdBanner'});
|
||||||
return textStr;
|
return textStr;
|
||||||
@ -331,7 +331,7 @@ twitch-videoad.js application/javascript
|
|||||||
streamInfo.BackupRegUrl = null;
|
streamInfo.BackupRegUrl = null;
|
||||||
streamInfo.BackupRegRes = null;
|
streamInfo.BackupRegRes = null;
|
||||||
streamInfo.IsMidroll = false;
|
streamInfo.IsMidroll = false;
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||||
@ -342,6 +342,7 @@ twitch-videoad.js application/javascript
|
|||||||
streamInfo.Urls[lines[i]] = res;
|
streamInfo.Urls[lines[i]] = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
streamInfo.HadAds[lines[i]] = false;
|
||||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name TwitchAdSolutions (notify-reload)
|
// @name TwitchAdSolutions (notify-reload)
|
||||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||||
// @version 1.9
|
// @version 1.10
|
||||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
|
// @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
|
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-reload/notify-reload.user.js
|
||||||
// @description Multiple solutions for blocking Twitch ads (notify-reload)
|
// @description Multiple solutions for blocking Twitch ads (notify-reload)
|
||||||
@ -150,7 +150,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
streamInfo.HadAds = true;
|
streamInfo.HadAds[url] = true;
|
||||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||||
@ -274,9 +274,9 @@
|
|||||||
streamInfo.BackupUrl = null;
|
streamInfo.BackupUrl = null;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (streamInfo.HadAds) {
|
if (streamInfo.HadAds[url]) {
|
||||||
postMessage({key:'UboPauseResumePlayer'});
|
postMessage({key:'UboPauseResumePlayer'});
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds[url] = false;
|
||||||
}
|
}
|
||||||
postMessage({key:'UboHideAdBanner'});
|
postMessage({key:'UboHideAdBanner'});
|
||||||
return textStr;
|
return textStr;
|
||||||
@ -342,7 +342,7 @@
|
|||||||
streamInfo.BackupRegUrl = null;
|
streamInfo.BackupRegUrl = null;
|
||||||
streamInfo.BackupRegRes = null;
|
streamInfo.BackupRegRes = null;
|
||||||
streamInfo.IsMidroll = false;
|
streamInfo.IsMidroll = false;
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||||
@ -353,6 +353,7 @@
|
|||||||
streamInfo.Urls[lines[i]] = res;
|
streamInfo.Urls[lines[i]] = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
streamInfo.HadAds[lines[i]] = false;
|
||||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ twitch-videoad.js application/javascript
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
streamInfo.HadAds = true;
|
streamInfo.HadAds[url] = true;
|
||||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||||
@ -263,9 +263,9 @@ twitch-videoad.js application/javascript
|
|||||||
streamInfo.BackupUrl = null;
|
streamInfo.BackupUrl = null;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (streamInfo.HadAds) {
|
if (streamInfo.HadAds[url]) {
|
||||||
postMessage({key:'UboPauseResumePlayer'});
|
postMessage({key:'UboPauseResumePlayer'});
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds[url] = false;
|
||||||
}
|
}
|
||||||
postMessage({key:'UboHideAdBanner'});
|
postMessage({key:'UboHideAdBanner'});
|
||||||
return textStr;
|
return textStr;
|
||||||
@ -331,7 +331,7 @@ twitch-videoad.js application/javascript
|
|||||||
streamInfo.BackupRegUrl = null;
|
streamInfo.BackupRegUrl = null;
|
||||||
streamInfo.BackupRegRes = null;
|
streamInfo.BackupRegRes = null;
|
||||||
streamInfo.IsMidroll = false;
|
streamInfo.IsMidroll = false;
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||||
@ -342,6 +342,7 @@ twitch-videoad.js application/javascript
|
|||||||
streamInfo.Urls[lines[i]] = res;
|
streamInfo.Urls[lines[i]] = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
streamInfo.HadAds[lines[i]] = false;
|
||||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name TwitchAdSolutions (notify-strip)
|
// @name TwitchAdSolutions (notify-strip)
|
||||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||||
// @version 1.9
|
// @version 1.10
|
||||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
|
// @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
|
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/notify-strip/notify-strip.user.js
|
||||||
// @description Multiple solutions for blocking Twitch ads (notify-strip)
|
// @description Multiple solutions for blocking Twitch ads (notify-strip)
|
||||||
@ -150,7 +150,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
streamInfo.HadAds = true;
|
streamInfo.HadAds[url] = true;
|
||||||
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
streamInfo.IsMidroll = textStr.includes('"MIDROLL"') || textStr.includes('"midroll"');
|
||||||
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
postMessage({key:'UboShowAdBanner',isMidroll:streamInfo.IsMidroll});
|
||||||
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
// Notify ads "watched" TODO: Keep crafting these requests even after ad tags are gone as sometimes it stops too early.
|
||||||
@ -274,9 +274,9 @@
|
|||||||
streamInfo.BackupUrl = null;
|
streamInfo.BackupUrl = null;
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (streamInfo.HadAds) {
|
if (streamInfo.HadAds[url]) {
|
||||||
postMessage({key:'UboPauseResumePlayer'});
|
postMessage({key:'UboPauseResumePlayer'});
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds[url] = false;
|
||||||
}
|
}
|
||||||
postMessage({key:'UboHideAdBanner'});
|
postMessage({key:'UboHideAdBanner'});
|
||||||
return textStr;
|
return textStr;
|
||||||
@ -342,7 +342,7 @@
|
|||||||
streamInfo.BackupRegUrl = null;
|
streamInfo.BackupRegUrl = null;
|
||||||
streamInfo.BackupRegRes = null;
|
streamInfo.BackupRegRes = null;
|
||||||
streamInfo.IsMidroll = false;
|
streamInfo.IsMidroll = false;
|
||||||
streamInfo.HadAds = false;
|
streamInfo.HadAds = [];// xxx.m3u8 -> bool (had ads on prev request)
|
||||||
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
var lines = encodingsM3u8.replace('\r', '').split('\n');
|
||||||
for (var i = 0; i < lines.length; i++) {
|
for (var i = 0; i < lines.length; i++) {
|
||||||
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
if (!lines[i].startsWith('#') && lines[i].includes('.m3u8')) {
|
||||||
@ -353,6 +353,7 @@
|
|||||||
streamInfo.Urls[lines[i]] = res;
|
streamInfo.Urls[lines[i]] = res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
streamInfo.HadAds[lines[i]] = false;
|
||||||
StreamInfosByUrl[lines[i]] = streamInfo;
|
StreamInfosByUrl[lines[i]] = streamInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user