elliotwaite / thumbnail-rating-bar-for-youtube

A Chrome and Firefox extension for YouTube that adds a rating bar (likes/dislikes ratio) to the bottom of every thumbnail.
https://chrome.google.com/webstore/detail/youtube-thumbnail-rating/cmlddjbnoehmihdmfhaacemlpgfbpoeb
MIT License
249 stars 17 forks source link

Primary invidious API down, ratings no longer work for `invidious` api key option #29

Open jdb8 opened 3 years ago

jdb8 commented 3 years ago

First off - thanks for making this extension!

I was previously using the invidious api key to avoid needing to set up my own one, but noticed that rating bars stopped appearing recently. Looks like this is because the code in background.js hits invidio.us: https://github.com/elliotwaite/thumbnail-rating-bar-for-youtube/blob/master/extension/background.js#L17, which according to the project homepage is no longer active.

From the page, it also looks like there are a bunch of mirrors, although it's unclear who runs them. I'm not sure if there's a single canonical replacement, but I tried locally replacing that api call with one to invidious.xyz, and it appears to work:

diff --git a/extension/background.js b/extension/background.js
index afb3c12..5e008a5 100644
--- a/extension/background.js
+++ b/extension/background.js
@@ -14,7 +14,7 @@ chrome.runtime.onMessage.addListener(
       let promises = []
       if (youtubeApiKey === 'invidious') {
         for (let videoId of message.videoIds) {
-          let promise = fetch(`https://invidio.us/api/v1/videos/${videoId}?fields=likeCount,dislikeCount`)
+          let promise = fetch(`https://invidious.xyz/api/v1/videos/${videoId}?fields=likeCount,dislikeCount`)
             .then(response => response.json())
             .then(data => {
               combined_data.items.push({

If this seems like a suitable fix, I'm happy to create a PR with this diff - but wanted to check here in case someone with more knowledge about these mirrors has a better idea.

elliotwaite commented 3 years ago

Thanks for pointing this out. I tried all the mirror URLs, but invidious.site was the only one I could get working without running into CORS errors or request limit exceeded errors. Unfortunately, it doesn't have the best health rating on https://invidio.us. But I've switched the code to use that URL for now. The update has been released in v1.0.2. Let me know if this resolves this issue for now.

Gitoffthelawn commented 3 years ago

I gave v1.3.1 of this extension another try, but the ratings from the thumbnail were not present when entering the string invidious for the API key (in the extension's settings). Did I make an error, or is this not currently working?

elliotwaite commented 3 years ago

Thanks for pointing this out. Looks like the invidious.site URL seemed to stop working for some reason. I just updated the extension (v1.3.3) to use the alternative ytprivate.com URL instead, which seems to be working. Let me know if this doesn't fix the issue for you.

Gitoffthelawn commented 3 years ago

Bug reported by QA, fixed by developer, and new release tested and verified working by QA in well under 3 hours. Talk about efficiency and teamwork! 👍🏾