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
250 stars 15 forks source link

Google has dropped the dislike count, thanks for the great extension! It was very helpful over all of these years :1st_place_medal: #50

Open NeveHanter opened 3 years ago

NeveHanter commented 3 years ago

More info: https://support.google.com/youtube/thread/134791097/update-to-youtube-dislike-counts Relevant HN discussion: https://news.ycombinator.com/item?id=29177091

Saxayone commented 2 years ago

The new API is rate-limited by IP address, so let me know if any of you are running into rate-limiting issues, such as the rating bar not being added to some of the thumbnails.

I have been a number of times now =/

However, if you refresh the tab, or open a new tab, the cache for that tab is reset. But if needed, I could also enable a global cache across all tabs that is time-based, which might help further reduce the number of API calls.

This would help so much =)

MichaelMMasi commented 2 years ago

I have also noticed the rating bar not loading for some videos when opening large playlists and scrolling rapidly, through hundreds of videos. In my usage this occurs often (multiple times daily).

elliotwaite commented 2 years ago

@Saxayone and @MichaelMMasi, thanks for the feedback. I'll add a configurable global cache soon which should help.

elliotwaite commented 2 years ago

The global cache has been added (version 1.7.0). The default cache duration is 10 minutes, but this can be configured in the settings. The current longest duration option is 24 hr, but if anyone would want a longer option, let me know.

Also, to further help with rate limiting, I've opened a feature request for the Return YouTube Dislike API to support batch requests. If you'd like to support this feature request, giving it a thumbs up here might help: https://github.com/Anarios/return-youtube-dislike/issues/319

xzuyn commented 1 year ago

The current longest duration option is 24 hr

How large does the cache get within 24 hours? I'd assume even with loading a large amount of videos maxing out the API rate for the entire 24 hours, it wouldn't be that large. Maybe a couple MBs max?

Is there a downside to a large cache compared to a small one? Like page loading speed with slow hard drives? or page performance on slower systems?

How does the cache expire? Does the entire cache expire at the 24 hour mark (including from videos cached less than 24 hours old), or is each video marked with a timestamp and only after a video's cache timestamp reaches 24 hours it gets cleared?

Also thanks for the extension :)

elliotwaite commented 1 year ago

@xzuyn The cache should be quite small. For each video it only stores the video ID, the like count, the dislike count, and the time when that data was retrieved. I’m not sure what a typical size would be in MB.

The downside of using a longer cache duration isn’t so much memory size, but rather that you wouldn’t always be seeing the latest ratings. This is mostly only important for recently released videos. The main upside of using a longer cache duration is that it reduces the chance of hitting the rating API’s rate limit. When you hit the rate limit, you will start seeing thumbnails don’t have rating bars added to them. Another benefit of a longer cache duration is that the cached rating bars may load slightly faster, but this difference is usually negligible.

The cache expires on a rolling basis, meaning if you set the cache duration to be 24 hours, any rating data you retrieved within the last 24 hours will still be in the cache. Or thought of another way, when you see a thumbnail which isn’t in the cache, it retrieves the current rating for that video, and then will reuse that rating if you ever see that thumbnail again in the next 24 hours. Closing and reopening the browser also clears the cache.