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

Auto speed stopped working for me #2175

Open
Walkerbo opened this issue Apr 9, 2024 · 20 comments
Open

Auto speed stopped working for me #2175

Walkerbo opened this issue Apr 9, 2024 · 20 comments
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) modern art & dadaism Riddle up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥

Comments

@Walkerbo
Copy link

Walkerbo commented Apr 9, 2024

1. Bug Report:

I have set all vvids to run at 1.75% yet each video only plays at normal speed.

Using Chome web-browser
Also have installed:

    • Adblock for Youtube
    • Return YouTube Dislike
@Walkerbo Walkerbo added Bug Bug or required update after YouTube changes Feature request Wish or idea good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥ labels Apr 9, 2024
@kashvi0
Copy link

kashvi0 commented Apr 9, 2024

have you checked the "Remember playback speed" option? remember to scroll down and save changes after you change any settings. please let me know if the issue still persists.

@ImprovedTube ImprovedTube added No entiendo🥺 Seems we didnt understand some part. (Not enough information or unclear wording? Or out of scope?) Riddle Philosophy and removed Bug Bug or required update after YouTube changes Feature request Wish or idea labels Apr 9, 2024
@ImprovedTube
Copy link
Member

@Walkerbo since when? did you notice the music-exclusion? It generally works and video playback is expected to change hardly (unlike youtube's layout)

hi @kashvi0, whats going on?

@Walkerbo
Copy link
Author

Walkerbo commented Apr 9, 2024

I cannot see a "Remember Playback Speed" option, and there does not seem to be a save button.

I have attached a gif that shows you what I see.
YoutubeSpeed

@ImprovedTube
Copy link
Member

sorry, i know, @kashvi0's comment is fantasy or AI.

@ImprovedTube ImprovedTube removed the No entiendo🥺 Seems we didnt understand some part. (Not enough information or unclear wording? Or out of scope?) label Apr 9, 2024
@ImprovedTube
Copy link
Member

nice to see your video counter near 12000 @Walkerbo
did you make your whole .gif & comment within 1 minute?

@ImprovedTube ImprovedTube added modern art & dadaism Bug Bug or required update after YouTube changes and removed Philosophy labels Apr 9, 2024
@kashvi0
Copy link

kashvi0 commented Apr 10, 2024

@Walkerbo sorry, i really wanted to help but got the features confused. i'm really sorry.

@ImprovedTube i assure you, my comment is not AI (idk what you mean by fantasy). sorry again.

@ImprovedTube
Copy link
Member

ImprovedTube commented Apr 11, 2024

@kashvi0 Fantasy and or AI can be used for something good.
We didnt have any "Remember ____"-buttons, or "Save changes"-buttons.
You might only come up with this if you didn't use this app before.
Every setting is remembered with one click.

@Walkerbo
Copy link
Author

There seems to be some posts here that are AI so I not sure what some of them mean but I did not write the post that has fantasy in it.
I wrote the original bug post and the post that has the gif, none of the others were by me.
I can confirm that I have used your extension for a very long time without issue.

@ImprovedTube
Copy link
Member

hi! @Walkerbo yes, please check the browser console on youtube for clues about the bug. The following step/s in our bug-report template, like logging out might also help (and checking the experiments-list if so).

@CodeClimberNT
Copy link

I found myself experiencing the same bug, from the list of extension provided I have in common only return of dislike button, although disabling it doesn't change anything. Is there a way to see in the console only the error thrown by a single extension?
Although the video does not start with the requested speed, the shortcut I can change it without any problem and changing the default speed when a video is playing does indeed change it in real time.

@ImprovedTube
Copy link
Member

other browser users or incognito window

@ImprovedTube
Copy link
Member

hi! @CodeClimberNT @Walkerbo does this actually happen always? #2028 thanks!

@Walkerbo
Copy link
Author

Walkerbo commented May 14, 2024

@ImprovedTube
For me the speed issue did not happen always, but now it seems to be working correctly for me.

@ImprovedTube
Copy link
Member

thanks! @Walkerbo works since a few days?
at what frequency didn't it work before?
and what browser (or anything you might have in common @CodeClimberNT )

@Walkerbo
Copy link
Author

@ImprovedTube, has been working since Monday so almost 3 days.
How frequently; there were days when it didn't work at all, no matter what I tried; and other days when it worked only on some of the videos I opened.
I use Chrome and have attached a list of all of the extensions I use.
Cdawapture

@Walkerbo
Copy link
Author

It has stopped working again.
Some speed up and others do not.
Those that do not I have to manually speed up.

@CodeClimberNT
Copy link

hi! @CodeClimberNT @Walkerbo does this actually happen always? #2028 thanks!

Sorry for the late response, it always happens, but the behavior is kind of strange
There are two possible cases:

  1. the extension did not initialize properly, and the experience is pretty similar to the usual YouTube behavior → usually a refresh of the page fix the issue and set the correct speed (still kind of annoying to refresh every video I watch)
  2. the extension actually work but the autospeed does not set automatically but the shortcut works and I can set it up quickly that way.

In reference to the other issue where I was mentioned (#2137) this issue was fixed, but still have troubles with the speed, although now it's much more manageable

@colinstu12
Copy link

I'm experiencing this issue too. Even a page refresh does not fix this. The only time it seems to work is if the tab has been discarded in the background and then the page reloads when going back to it. But as far as opening links to videos normally and refreshing normally, it does not apply the speedup.

@raszpl
Copy link
Contributor

raszpl commented Jun 26, 2024

this is why it doesnt work:

ImprovedTube.playerPlaybackSpeed = function () { if (this.storage.player_forced_playback_speed === true) {
var player = this.elements.player,
video = player.querySelector('video'),
option = this.storage.player_playback_speed;
if (this.isset(option) === false) { option = 1; }
else if ( option !== 1 && video.playbackRate !== option && (video.playbackRate > 1 || video.playbackRate < 1) )
{ console.log("skipping permanent speed, since speed was manually set differently for this video to:" + video.playbackRate); return; }
if ( !player.getVideoData().isLive || player.getVideoData().isLive === false)
{ player.setPlaybackRate(Number(option)); video.playbackRate = Number(option); // #1729 q2 // hi! @raszpl
if ( (this.storage.player_force_speed_on_music !== true || this.storage.player_dont_speed_education === true)
&& option !== 1) {
ImprovedTube.speedException = function () {
if (this.storage.player_dont_speed_education === true && DATA.genre === 'Education')
{player.setPlaybackRate(Number(1)); video.playbackRate = Number(1); return;}
if (this.storage.player_force_speed_on_music === true)
{ //player.setPlaybackRate(Number(option)); video.playbackRate = Number(option);
return;}
if (DATA.keywords && !keywords) { keywords = DATA.keywords.join(', ') || ''; }
if (keywords === 'video, sharing, camera phone, video phone, free, upload') { keywords = ''; }
var musicIdentifiers = /(official|music|lyrics?)[ -]video|(cover|studio|radio|album|alternate)[- ]version|soundtrack|unplugged|\bmedley\b|\blo-fi\b|\blofi\b|a(lla)? cappella|feat\.|(piano|guitar|jazz|ukulele|violin|reggae)[- ](version|cover)|karaok|backing[- ]track|instrumental|(sing|play)[- ]?along|卡拉OK|卡拉OK|الكاريوكي|караоке|カラオケ|노래방|bootleg|mashup|Radio edit|Guest (vocals|musician)|(title|opening|closing|bonus|hidden)[ -]track|live acoustic|interlude|featuring|recorded (at|live)/i;
var musicIdentifiersTitleOnly = /lyrics|theme song|\bremix|\bAMV ?[^a-z0-9]|[^a-z0-9] ?AMV\b|\bfull song\b|\bsong:|\bsong[\!$]|^song\b|( - .*\bSong\b|\bSong\b.* - )|cover ?[^a-z0-9]|[^a-z0-9] ?cover|\bconcert\b/i;
var musicIdentifiersTitle = new RegExp(musicIdentifiersTitleOnly.source + '|' + musicIdentifiers.source, "i");
var musicRegexMatch = musicIdentifiersTitle.test(DATA.title);
if (!musicRegexMatch) {
var musicIdentifiersTagsOnly = /, (lyrics|remix|song|music|AMV|theme song|full song),|\(Musical Genre\)|, jazz|, reggae/i;
var musicIdentifiersTags = new RegExp(musicIdentifiersTagsOnly.source + '|' + musicIdentifiers.source, "i");
keywordsAmount = 1 + ((keywords || '').match(/,/) || []).length;
if ( ((keywords || '').match(musicIdentifiersTags) || []).length / keywordsAmount > 0.08) {
musicRegexMatch = true}}
notMusicRegexMatch = /\bdo[ck]u|interv[iyj]|back[- ]?stage|インタビュー|entrevista|面试|面試|회견|wawancara|مقابلة|интервью|entretien|기록한 것|记录|記錄|ドキュメンタリ|وثائقي|документальный/i.test(DATA.title + " " + keywords);
// (Tags/keywords shouldnt lie & very few songs titles might have these words)
if (DATA.duration) {
function parseDuration(duration) { const [_, h = 0, m = 0, s = 0] = duration.match(/PT(?:(\d+)?H)?(?:(\d+)?M)?(\d+)?S?/).map(part => parseInt(part) || 0);
return h * 3600 + m * 60 + s; }
DATA.lengthSeconds = parseDuration(DATA.duration); }
function testSongDuration(s, ytMusic) {
if (135 <= s && s <= 260) {return 'veryCommon';}
if (105 <= s && s <= 420) {return 'common';}
if (420 <= s && s <= 720) {return 'long';}
if (45 <= s && s <= 105) {return 'short';}
if (ytMusic && ytMusic > 1 && (85 <= s / ytMusic && (s / ytMusic <= 375 || ytMusic == 10))) {return 'multiple';}
//does Youtube ever show more than 10 songs below the description?
}
var songDurationType = testSongDuration(DATA.lengthSeconds);
console.log("genre: " + DATA.genre + "//title: " + DATA.title + "//keywords: " + keywords + "//music word match: " + musicRegexMatch + "// not music word match:" + notMusicRegexMatch + "//duration: " + DATA.lengthSeconds + "//song duration type: " + songDurationType);
// check if the video is PROBABLY MUSIC:
if ( ( DATA.genre === 'Music' && (!notMusicRegexMatch || songDurationType === 'veryCommon'))
|| ( musicRegexMatch && !notMusicRegexMatch && (typeof songDurationType !== 'undefined'
|| (/album|Álbum|专辑|專輯|एलबम|البوم|アルバム|альбом|앨범|mixtape|concert|playlist|\b(live|cd|vinyl|lp|ep|compilation|collection|symphony|suite|medley)\b/i.test(DATA.title + " " + keywords)
&& 1000 <= DATA.lengthSeconds )) ) // && 1150 <= DATA.lengthSeconds <= 5000
|| ( DATA.genre === 'Music' && musicRegexMatch && (typeof songDurationType !== 'undefined'
|| (/album|Álbum|专辑|專輯|एलबम|البوم|アルバム|альбом|앨범|mixtape|concert|playlist|\b(live|cd|vinyl|lp|ep|compilation|collection|symphony|suite|medley)\b/i.test(DATA.title + " " + keywords)
&& 1000 <= DATA.lengthSeconds )) ) // && DATA.lengthSeconds <= 5000
|| (amountOfSongs && testSongDuration(DATA.lengthSeconds, amountOfSongs ) !== 'undefined')
// || location.href.indexOf('music.') !== -1 // (=currently we are only running on www.youtube.com anyways)
) { player.setPlaybackRate(1); video.playbackRate = 1; console.log ("...,thus must be music?"); }
else { // Now this video might rarely be music
// - however we can make extra-sure after waiting for the video descripion to load... (#1539)
var tries = 0; var intervalMs = 210; if (location.href.indexOf('/watch?') !== -1) {var maxTries = 10;} else {var maxTries = 0;}
// ...except when it is an embedded player?
var waitForDescription = setInterval(() => {
if (++tries >= maxTries) {
subtitle = document.querySelector('#title + #subtitle:last-of-type')
if ( subtitle && 1 <= Number((subtitle?.innerHTML?.match(/^\d+/) || [])[0]) // indicates buyable/registered music (amount of songs)
&& typeof testSongDuration(DATA.lengthSeconds, Number((subtitle?.innerHTML?.match(/^\d+/) || [])[0]) ) !== 'undefined' ) // resonable duration
{player.setPlaybackRate(1); video.playbackRate = 1; console.log("...but YouTube shows music below the description!"); clearInterval(waitForDescription); }
intervalMs *= 1.11; }}, intervalMs);
window.addEventListener('load', () => { setTimeout(() => { clearInterval(waitForDescription); }, 1234); });
}
}
//DATA (TO-DO: make the Data available to more/all features? #1452 #1763 (Then can replace ImprovedTube.elements.category === 'music', VideoID is also used elsewhere)
DATA = {};
defaultKeywords = "video,sharing,camera,phone,video phone,free,upload";
DATA.keywords = false; keywords = false; amountOfSongs = false;
DATA.videoID = ImprovedTube.videoId() || false;
ImprovedTube.fetchDOMData = function () {
// if (history.length > 1 && history.state.endpoint.watchEndpoint) {
try { DATA = JSON.parse(document.querySelector('#microformat script')?.textContent) ?? false; DATA.title = DATA.name;}
catch { DATA.genre = false; DATA.keywords = false; DATA.lengthSeconds = false;
try {
DATA.title = document.getElementsByTagName('meta')?.title?.content || false;
DATA.genre = document.querySelector('meta[itemprop=genre]')?.content || false;
DATA.duration = document.querySelector('meta[itemprop=duration]')?.content || false;
} catch {}} if ( DATA.title === ImprovedTube.videoTitle() )
{ keywords = document.getElementsByTagName('meta')?.keywords?.content || false; if(!keywords){keyword=''} ImprovedTube.speedException(); }
else { keywords = ''; (async function () { try { const response = await fetch(`https://www.youtube.com/watch?v=${DATA.videoID}`);
const htmlContent = await response.text();
const metaRegex = /<meta[^>]+name=["'](keywords|genre|duration)["'][^>]+content=["']([^"']+)["'][^>]*>/gi;
let match; while ((match = metaRegex.exec(htmlContent)) !== null) {
const [, property, value] = match;
if (property === 'keywords') { keywords = value;} else {DATA[property] = value;}
}
amountOfSongs = (htmlContent.slice(-80000).match(/},"subtitle":{"simpleText":"(\d*)\s/) || [])[1] || false;
if (keywords) { ImprovedTube.speedException(); }
} catch (error) { console.error('Error: fetching from https://Youtube.com/watch?v=${DATA.videoID}', error); keywords = ''; }
})();
}
};
if ( (history && history.length === 1) || !history?.state?.endpoint?.watchEndpoint) { ImprovedTube.fetchDOMData();}
else {
//Invidious instances. Should be updated automatically!...
const invidiousInstances = ['invidious.fdn.fr','inv.tux.pizza','invidious.flokinet.to','invidious.protokolla.fi','invidious.private.coffee','yt.artemislena.eu','invidious.perennialte.ch','invidious.materialio.us','iv.datura.network'];
function getRandomInvidiousInstance() { return invidiousInstances[Math.floor(Math.random() * invidiousInstances.length)];}
(async function () { let retries = 4; let invidiousFetched = false;
async function fetchInvidiousData() {
try {const response = await fetch(`https://${getRandomInvidiousInstance()}/api/v1/videos/${DATA.videoID}?fields=genre,title,lengthSeconds,keywords`);
DATA = await response.json();
if (DATA.genre && DATA.title && DATA.keywords && DATA.lengthSeconds) { if (DATA.keywords.toString() === defaultKeywords ) {DATA.keywords = ''}
ImprovedTube.speedException(); invidiousFetched = true; }
} catch (error) { console.error('Error: Invidious API: ', error); }
}
while (retries > 0 && !invidiousFetched) { await fetchInvidiousData();
if (!invidiousFetched) { await new Promise(resolve => setTimeout(resolve, retries === 4 ? 1500 : 876)); retries--; } }
if(!invidiousFetched){ if (document.readyState === 'loading') {document.addEventListener('DOMContentLoaded', ImprovedTube.fetchDOMData())}
else { ImprovedTube.fetchDOMData();} }
})();
}
} // else { }
}
}
}

its a jungle, last time I was here it was 1/6 the size and still required fixing #1729

@ImprovedTube
Copy link
Member

hi! @CodeClimberNT @colinstu12 @raszpl @Walkerbo @kashvi0

prior to #2175 67d8db5 ( in response to #1760 (comment) ) or this:

else if ( option !== 1 && video.playbackRate !== option && (video.playbackRate > 1 || video.playbackRate < 1) )
{ console.log("skipping permanent speed, since speed was manually set differently for this video to:" + video.playbackRate); return; }
)
While #1856 might be prior and independent to the addition that scared you @raszpl : 78cebf3 ( by what @shadow-ryu said )


to be precise again: when clicking related videos and also excluding music, then it might take seconds to undo the speed while we wait for data for infos from invidious or Youtube. And some invidious nodes didn't work so the list is currently reduced to just the top few.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug or required update after YouTube changes good first issue A GitHub standard for inviting (new) contributors *Congratulations in advance!* help wanted Just an old github standard we add automatically. (The team can remove it when working on it.) modern art & dadaism Riddle up-for-grabs (a github standard for inviting new contributors) - Welcome! ♥
Projects
None yet
Development

No branches or pull requests

6 participants