Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback to 360p stream #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions chrome/remove_video_ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function declareOptions(scope) {
//scope.PlayerType1 = 'site'; //Source - NOTE: This is unused as it's implicitly used by the website iself
scope.PlayerType2 = 'embed'; //Source
scope.PlayerType3 = 'proxy'; //Source
scope.PlayerType4 = 'thunderdome'; //480p
scope.PlayerType4 = 'autoplay'; //360p
scope.CurrentChannelName = null;
scope.UsherParams = null;
scope.WasShowingAd = false;
Expand Down Expand Up @@ -192,8 +192,8 @@ window.Worker = class Worker extends oldWorker {
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"]');
Expand All @@ -205,7 +205,7 @@ window.Worker = class Worker extends oldWorker {
}
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;
Expand Down Expand Up @@ -253,6 +253,7 @@ window.Worker = class Worker extends oldWorker {
var currentQualityLS = window.localStorage.getItem('video-quality');

lowQuality[qualityToSelect].click();
settingsCog.click();
window.localStorage.setItem('video-quality', currentQualityLS);

if (e.data.value != null) {
Expand Down Expand Up @@ -703,7 +704,7 @@ function adRecordgqlPacket(event, radToken, payload) {

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,
Expand Down
11 changes: 6 additions & 5 deletions firefox/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function removeVideoAds() {
//scope.PlayerType1 = 'site'; //Source - NOTE: This is unused as it's implicitly used by the website iself
scope.PlayerType2 = 'embed'; //Source
scope.PlayerType3 = 'proxy'; //Source
scope.PlayerType4 = 'thunderdome'; //480p
scope.PlayerType4 = 'autoplay'; //360p
scope.CurrentChannelName = null;
scope.UsherParams = null;
scope.WasShowingAd = false;
Expand Down Expand Up @@ -196,8 +196,8 @@ function removeVideoAds() {
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"]');
Expand All @@ -209,7 +209,7 @@ function removeVideoAds() {
}
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;
Expand Down Expand Up @@ -257,6 +257,7 @@ function removeVideoAds() {
var currentQualityLS = window.localStorage.getItem('video-quality');

lowQuality[qualityToSelect].click();
settingsCog.click();
window.localStorage.setItem('video-quality', currentQualityLS);

if (e.data.value != null) {
Expand Down Expand Up @@ -707,7 +708,7 @@ function removeVideoAds() {

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,
Expand Down