diff --git a/vaft/vaft-ublock-origin.js b/vaft/vaft-ublock-origin.js index 0426566..f8d2071 100644 --- a/vaft/vaft-ublock-origin.js +++ b/vaft/vaft-ublock-origin.js @@ -1,7 +1,8 @@ twitch-videoad.js text/javascript (function() { if ( /(^|\.)twitch\.tv$/.test(document.location.hostname) === false ) { return; } - var ourTwitchAdSolutionsVersion = 9;// Used to prevent conflicts with outdated versions of the scripts + 'use strict'; + var ourTwitchAdSolutionsVersion = 10;// Used to prevent conflicts with outdated versions of the scripts if (typeof unsafeWindow === 'undefined') { unsafeWindow = window; } @@ -327,13 +328,16 @@ twitch-videoad.js text/javascript //Here we check the m3u8 for any ads and also try fallback player types if needed. var responseText = await response.text(); var weaverText = null; - weaverText = await processM3U8(url, responseText, realFetch, PlayerType2); + var fallbackWeaverText = weaverText = await processM3U8(url, responseText, realFetch, PlayerType2); if (weaverText.includes(AdSignifier)) { weaverText = await processM3U8(url, responseText, realFetch, PlayerType3); } if (weaverText.includes(AdSignifier)) { weaverText = await processM3U8(url, responseText, realFetch, PlayerType4); } + if (weaverText.includes(AdSignifier)) { + weaverText = fallbackWeaverText; + } resolve(new Response(weaverText)); } else { resolve(response); diff --git a/vaft/vaft.user.js b/vaft/vaft.user.js index 174b2cf..918f2bd 100644 --- a/vaft/vaft.user.js +++ b/vaft/vaft.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name TwitchAdSolutions (vaft) // @namespace https://github.com/pixeltris/TwitchAdSolutions -// @version 24.0.0 +// @version 25.0.0 // @description Multiple solutions for blocking Twitch ads (vaft) // @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js // @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/vaft/vaft.user.js @@ -14,7 +14,7 @@ // ==/UserScript== (function() { 'use strict'; - var ourTwitchAdSolutionsVersion = 9;// Used to prevent conflicts with outdated versions of the scripts + var ourTwitchAdSolutionsVersion = 10;// Used to prevent conflicts with outdated versions of the scripts if (typeof unsafeWindow === 'undefined') { unsafeWindow = window; } @@ -340,13 +340,16 @@ //Here we check the m3u8 for any ads and also try fallback player types if needed. var responseText = await response.text(); var weaverText = null; - weaverText = await processM3U8(url, responseText, realFetch, PlayerType2); + var fallbackWeaverText = weaverText = await processM3U8(url, responseText, realFetch, PlayerType2); if (weaverText.includes(AdSignifier)) { weaverText = await processM3U8(url, responseText, realFetch, PlayerType3); } if (weaverText.includes(AdSignifier)) { weaverText = await processM3U8(url, responseText, realFetch, PlayerType4); } + if (weaverText.includes(AdSignifier)) { + weaverText = fallbackWeaverText; + } resolve(new Response(weaverText)); } else { resolve(response);