return-youtube-dislike
return-youtube-dislike copied to clipboard
(Bug): Re-format like numbers feature breaks youtube shorts like display
Browser
Brave
Browser Version
1.38.109 Chromium: 101.0.4951.41
Extension or Userscript?
Extension
Extension/Userscript Version
Version: 3.0.0.1
Video link where you see the problem
https://youtube.com/shorts/zqO22bpatLs?feature=share
What happened?
After watching a couple youtube shorts I noticed every video showed 0 likes until I switched the "Re-format like numbers" option off.
How to reproduce/recreate?
Just watch any youtube shorts video with the "Re-format like numbers" option turned on.
<yt-formatted-string id="text" class="style-scope ytd-toggle-button-renderer style-text" aria-label="like this video along with 1.2K other people">0</yt-formatted-string>
Shorts don't have exact like counts. So we can't do formatting.
https://github.com/Anarios/return-youtube-dislike/blob/e4a52fe4de26fdae851cb6446fedd53c525323e8/Extensions/combined/src/state.js#L153
Here, return false
instead, so we can use RYD server data for exact like counts. Here:
https://github.com/Anarios/return-youtube-dislike/blob/e4a52fe4de26fdae851cb6446fedd53c525323e8/Extensions/combined/src/state.js#L168
if (extConfig.numberDisplayReformatLikes === true) {
const nativeLikes = getLikeCountFromButton();
if (nativeLikes !== false) {
setLikes(numberFormat(nativeLikes));
} else {
setLikes(numberFormat(response.likes));
}
}
https://github.com/Anarios/return-youtube-dislike/blob/e4a52fe4de26fdae851cb6446fedd53c525323e8/Extensions/combined/popup.html#L111
Here, change hover message to Make likes and dislikes format consistent. Shorts data are from RYD server.
Thanks @ErykDarnowski for reporting
Sorry for creating a bit of a mess, I've tried implementing these changes, but when I worked on another issue unfortunetly I commited the changes straight to main, so it looks like I won't be able to create a clean pull request for this issue. Again, sorry but I'm still learning how to work with github.
@ErykDarnowski Don't worry, and don't give up! Just do this one thing: always make a new branch from your main branch (assuming yours is always up to date with upstream) whenever you want to change one thing. Merge conflicts are often but in this way it's easier.
Great, thank you so much for the advice! When my pull request (the one where I commited to main) gets closed I'll do just that 😃
For that, you can do this trick: Create a new branch as if you want to make another PR. Cherry-pick all commits from your main branch and apply to the new branch. Make a new PR with the new branch. Force pull or sync or whatever that's called in git, do that on your main branch from upstream. Bottom line, your main branch should always be in sync with upstream. Every now and then you should check for new commits and ensure they are identical.
EDIT: Actually I overlooked the difficulty. Your main branch is already ahead, so it's not easy to create a new branch for this purpose. You can rebase, but what's the point. If I can get back some free time this weekend, I'll try to make a PR.
Exactly, thank you for trying to help, but it looks like I'll just have to wait! ;)
Ohh also, the same bug happens when using UserScript, so these changes also need to be implemented there.
I've got an idea, I'm not sure if it's a good one. Because I could technically:
- close that pull request I have open (where I commited to main)
- remove my current fork
- create a new fork
- apply changes I've made for that pull request on a new branch
- create a new pull request
What do you think? 🤔
You are getting close, but if you really want to do it ....
- Use "Revert commits" to revert changes you've made in main branch, go back to the point when you forked. Now you should have all your commits and revert commits on main branch.
- Sync your main with upstream.
- Create a new branch for the things you were working on using the main branch.
- Cherry pick the old commits from main. Don't pick the reverts, of course.
- Create a new PR with this new branch.
I should point out when you sync with upstream, there are two ways to do it. One way will eliminate all of your own work so your main branch is really "identical" to upstream. The other way makes the end results the same, but keeps your commits. And I don't remember which is which :) Stackoverflow time
You're right, the pull request will probably get merged soon, so I guess it's better to wait and have a fresh start, than mess with stuff :)