mirror of
https://github.com/pixeltris/TwitchAdSolutions.git
synced 2024-11-22 02:12:45 +01:00
Implement @level3tjg's 360p fallback
Ref: https://github.com/cleanlock/VideoAdBlockForTwitch/pull/96
This commit is contained in:
parent
e922bb7dce
commit
6a14447b9a
@ -58,9 +58,9 @@ twitch-videoad.js text/javascript
|
||||
scope.ClientVersion = 'null';
|
||||
scope.ClientSession = 'null';
|
||||
//scope.PlayerType1 = 'site'; //Source - NOTE: This is unused as it's implicitly used by the website iself
|
||||
scope.PlayerType2 = 'embed'; //Source
|
||||
scope.PlayerType2 = 'autoplay'; //360p
|
||||
scope.PlayerType3 = 'proxy'; //Source
|
||||
scope.PlayerType4 = 'thunderdome'; //480p
|
||||
scope.PlayerType4 = 'embed'; //Source
|
||||
scope.CurrentChannelName = null;
|
||||
scope.UsherParams = null;
|
||||
scope.WasShowingAd = false;
|
||||
@ -163,8 +163,8 @@ twitch-videoad.js text/javascript
|
||||
if (OriginalVideoPlayerQuality == null) {
|
||||
OriginalVideoPlayerQuality = currentQuality;
|
||||
}
|
||||
if (!currentQuality.includes('480') || e.data.value != null) {
|
||||
if (!OriginalVideoPlayerQuality.includes('480')) {
|
||||
if (!currentQuality.includes('360') || e.data.value != null) {
|
||||
if (!OriginalVideoPlayerQuality.includes('360')) {
|
||||
var settingsMenu = document.querySelector('div[data-a-target="player-settings-menu"]');
|
||||
if (settingsMenu == null) {
|
||||
var settingsCog = document.querySelector('button[data-a-target="player-settings-button"]');
|
||||
@ -176,7 +176,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
var lowQuality = document.querySelectorAll('input[data-a-target="tw-radio"');
|
||||
if (lowQuality) {
|
||||
var qualityToSelect = lowQuality.length - 3;
|
||||
var qualityToSelect = lowQuality.length - 2;
|
||||
if (e.data.value != null) {
|
||||
if (e.data.value.includes('original')) {
|
||||
e.data.value = OriginalVideoPlayerQuality;
|
||||
@ -223,6 +223,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
var currentQualityLS = window.localStorage.getItem('video-quality');
|
||||
lowQuality[qualityToSelect].click();
|
||||
settingsCog.click();
|
||||
window.localStorage.setItem('video-quality', currentQualityLS);
|
||||
if (e.data.value != null) {
|
||||
OriginalVideoPlayerQuality = null;
|
||||
@ -643,7 +644,7 @@ twitch-videoad.js text/javascript
|
||||
}
|
||||
function getAccessToken(channelName, playerType, realFetch) {
|
||||
var body = null;
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "ios", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "ios", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
body = {
|
||||
operationName: 'PlaybackAccessToken_Template',
|
||||
query: templateQuery,
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (vaft)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 5.8.0
|
||||
// @version 5.8.1
|
||||
// @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
|
||||
@ -69,9 +69,9 @@
|
||||
scope.ClientVersion = 'null';
|
||||
scope.ClientSession = 'null';
|
||||
//scope.PlayerType1 = 'site'; //Source - NOTE: This is unused as it's implicitly used by the website iself
|
||||
scope.PlayerType2 = 'embed'; //Source
|
||||
scope.PlayerType2 = 'autoplay'; //360p
|
||||
scope.PlayerType3 = 'proxy'; //Source
|
||||
scope.PlayerType4 = 'thunderdome'; //480p
|
||||
scope.PlayerType4 = 'embed'; //Source
|
||||
scope.CurrentChannelName = null;
|
||||
scope.UsherParams = null;
|
||||
scope.WasShowingAd = false;
|
||||
@ -174,8 +174,8 @@
|
||||
if (OriginalVideoPlayerQuality == null) {
|
||||
OriginalVideoPlayerQuality = currentQuality;
|
||||
}
|
||||
if (!currentQuality.includes('480') || e.data.value != null) {
|
||||
if (!OriginalVideoPlayerQuality.includes('480')) {
|
||||
if (!currentQuality.includes('360') || e.data.value != null) {
|
||||
if (!OriginalVideoPlayerQuality.includes('360')) {
|
||||
var settingsMenu = document.querySelector('div[data-a-target="player-settings-menu"]');
|
||||
if (settingsMenu == null) {
|
||||
var settingsCog = document.querySelector('button[data-a-target="player-settings-button"]');
|
||||
@ -187,7 +187,7 @@
|
||||
}
|
||||
var lowQuality = document.querySelectorAll('input[data-a-target="tw-radio"');
|
||||
if (lowQuality) {
|
||||
var qualityToSelect = lowQuality.length - 3;
|
||||
var qualityToSelect = lowQuality.length - 2;
|
||||
if (e.data.value != null) {
|
||||
if (e.data.value.includes('original')) {
|
||||
e.data.value = OriginalVideoPlayerQuality;
|
||||
@ -234,6 +234,7 @@
|
||||
}
|
||||
var currentQualityLS = window.localStorage.getItem('video-quality');
|
||||
lowQuality[qualityToSelect].click();
|
||||
settingsCog.click();
|
||||
window.localStorage.setItem('video-quality', currentQualityLS);
|
||||
if (e.data.value != null) {
|
||||
OriginalVideoPlayerQuality = null;
|
||||
@ -654,7 +655,7 @@
|
||||
}
|
||||
function getAccessToken(channelName, playerType, realFetch) {
|
||||
var body = null;
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "ios", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "ios", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
body = {
|
||||
operationName: 'PlaybackAccessToken_Template',
|
||||
query: templateQuery,
|
||||
|
@ -7,9 +7,11 @@ twitch-videoad.js text/javascript
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_MIN_REQUESTS = false;
|
||||
scope.OPT_BACKUP_PLAYER_TYPE = 'embed';
|
||||
scope.OPT_BACKUP_PLAYER_TYPE = 'autoplay';
|
||||
scope.OPT_BACKUP_PLATFORM = 'ios';
|
||||
scope.OPT_REGULAR_PLAYER_TYPE = 'site';
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = null;
|
||||
scope.OPT_SHOW_AD_BANNER = true;
|
||||
scope.AD_SIGNIFIER = 'stitched-ad';
|
||||
scope.LIVE_SIGNIFIER = ',live';
|
||||
scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko';
|
||||
@ -73,7 +75,9 @@ twitch-videoad.js text/javascript
|
||||
var adDiv = getAdDiv();
|
||||
if (adDiv != null) {
|
||||
adDiv.P.textContent = 'Blocking' + (e.data.isMidroll ? ' midroll' : '') + ' ads...';
|
||||
//adDiv.style.display = 'block';
|
||||
if (OPT_SHOW_AD_BANNER) {
|
||||
adDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
} else if (e.data.key == 'UboHideAdBanner') {
|
||||
var adDiv = getAdDiv();
|
||||
@ -213,7 +217,7 @@ twitch-videoad.js text/javascript
|
||||
for (var i = 0; i < 2; i++) {
|
||||
var encodingsUrl = url;
|
||||
if (i == 1) {
|
||||
var accessTokenResponse = await getAccessToken(channelName, OPT_BACKUP_PLAYER_TYPE);
|
||||
var accessTokenResponse = await getAccessToken(channelName, OPT_BACKUP_PLAYER_TYPE, OPT_BACKUP_PLATFORM, realFetch);
|
||||
if (accessTokenResponse != null && accessTokenResponse.status === 200) {
|
||||
var accessToken = await accessTokenResponse.json();
|
||||
var urlInfo = new URL('https://usher.ttvnw.net/api/channel/hls/' + channelName + '.m3u8' + (new URL(url)).search);
|
||||
@ -286,9 +290,12 @@ twitch-videoad.js text/javascript
|
||||
},
|
||||
}];
|
||||
}
|
||||
function getAccessToken(channelName, playerType, realFetch) {
|
||||
function getAccessToken(channelName, playerType, platform, realFetch) {
|
||||
if (!platform) {
|
||||
platform = 'web';
|
||||
}
|
||||
var body = null;
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "' + platform + '", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "' + platform + '", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
body = {
|
||||
operationName: 'PlaybackAccessToken_Template',
|
||||
query: templateQuery,
|
||||
|
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name TwitchAdSolutions (video-swap-new)
|
||||
// @namespace https://github.com/pixeltris/TwitchAdSolutions
|
||||
// @version 1.17
|
||||
// @version 1.18
|
||||
// @updateURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
|
||||
// @downloadURL https://github.com/pixeltris/TwitchAdSolutions/raw/master/video-swap-new/video-swap-new.user.js
|
||||
// @description Multiple solutions for blocking Twitch ads (video-swap-new)
|
||||
@ -18,9 +18,11 @@
|
||||
scope.OPT_MODE_STRIP_AD_SEGMENTS = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED = true;
|
||||
scope.OPT_MODE_NOTIFY_ADS_WATCHED_MIN_REQUESTS = false;
|
||||
scope.OPT_BACKUP_PLAYER_TYPE = 'embed';
|
||||
scope.OPT_BACKUP_PLAYER_TYPE = 'autoplay';
|
||||
scope.OPT_BACKUP_PLATFORM = 'ios';
|
||||
scope.OPT_REGULAR_PLAYER_TYPE = 'site';
|
||||
scope.OPT_ACCESS_TOKEN_PLAYER_TYPE = null;
|
||||
scope.OPT_SHOW_AD_BANNER = true;
|
||||
scope.AD_SIGNIFIER = 'stitched-ad';
|
||||
scope.LIVE_SIGNIFIER = ',live';
|
||||
scope.CLIENT_ID = 'kimne78kx3ncx6brgo4mv6wki5h1ko';
|
||||
@ -84,7 +86,9 @@
|
||||
var adDiv = getAdDiv();
|
||||
if (adDiv != null) {
|
||||
adDiv.P.textContent = 'Blocking' + (e.data.isMidroll ? ' midroll' : '') + ' ads...';
|
||||
//adDiv.style.display = 'block';
|
||||
if (OPT_SHOW_AD_BANNER) {
|
||||
adDiv.style.display = 'block';
|
||||
}
|
||||
}
|
||||
} else if (e.data.key == 'UboHideAdBanner') {
|
||||
var adDiv = getAdDiv();
|
||||
@ -224,7 +228,7 @@
|
||||
for (var i = 0; i < 2; i++) {
|
||||
var encodingsUrl = url;
|
||||
if (i == 1) {
|
||||
var accessTokenResponse = await getAccessToken(channelName, OPT_BACKUP_PLAYER_TYPE);
|
||||
var accessTokenResponse = await getAccessToken(channelName, OPT_BACKUP_PLAYER_TYPE, OPT_BACKUP_PLATFORM, realFetch);
|
||||
if (accessTokenResponse != null && accessTokenResponse.status === 200) {
|
||||
var accessToken = await accessTokenResponse.json();
|
||||
var urlInfo = new URL('https://usher.ttvnw.net/api/channel/hls/' + channelName + '.m3u8' + (new URL(url)).search);
|
||||
@ -297,9 +301,12 @@
|
||||
},
|
||||
}];
|
||||
}
|
||||
function getAccessToken(channelName, playerType, realFetch) {
|
||||
function getAccessToken(channelName, playerType, platform, realFetch) {
|
||||
if (!platform) {
|
||||
platform = 'web';
|
||||
}
|
||||
var body = null;
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "web", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
var templateQuery = 'query PlaybackAccessToken_Template($login: String!, $isLive: Boolean!, $vodID: ID!, $isVod: Boolean!, $playerType: String!) { streamPlaybackAccessToken(channelName: $login, params: {platform: "' + platform + '", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isLive) { value signature __typename } videoPlaybackAccessToken(id: $vodID, params: {platform: "' + platform + '", playerBackend: "mediaplayer", playerType: $playerType}) @include(if: $isVod) { value signature __typename }}';
|
||||
body = {
|
||||
operationName: 'PlaybackAccessToken_Template',
|
||||
query: templateQuery,
|
||||
|
Loading…
Reference in New Issue
Block a user