youtube-auto-liker icon indicating copy to clipboard operation
youtube-auto-liker copied to clipboard

New selectors for like and dislike buttons, plus for shorts

Open kas-cor opened this issue 1 year ago • 5 comments

kas-cor avatar Nov 23 '23 20:11 kas-cor

For the Shorts subscribe button, instead of testing for a class, we could test for the 'subscribed' attribute on the <ytd-subscribe-button-renderer> element which the subscribe button is a descendant of. The subscribe check would then look like this:

const subscribed = subscribeButton.hasAttribute('subscribe-button-invisible') || subscribeButton.hasAttribute('subscribed')

The selector for the subscribe button would then be:

SUBSCRIBE_BUTTON: '#subscribe-button > ytd-subscribe-button-renderer, ytd-reel-player-overlay-renderer #subscribe-button',

In my opinion, this is makes both the subscribe check and the selector cleaner and not dependent on the style of the UI.

BleakBluets avatar Dec 01 '23 06:12 BleakBluets

For the like/dislike button selectors, I made a similar change in #32, except, because there are two results for each button with those selectors, I think it may be necessary to be more specific due to issues raised in #17.

Your change also removes #segmented-like-button and #segmented-dislike-button, but they are still required, at least in my case. Those ids haven't been fully depreciated yet. ~~If the #like-button button selector is what you have, then~~ (I see this change was for the Shorts dis/like buttons) I believe that three selectors should be used like so:

LIKE_BUTTON: '#menu .YtLikeButtonViewModelHost button, #segmented-like-button button, #like-button button'

... and likewise for the dislike button:

DISLIKE_BUTTON: '#menu .YtDislikeButtonViewModelHost button, #segmented-dislike-button button, #dislike-button button'

These combined changes would also fix #30

BleakBluets avatar Dec 01 '23 06:12 BleakBluets

@BleakBluets I've implemented your suggestions (https://github.com/HatScripts/youtube-auto-liker/commit/9ea38ad28973392cf71e69eef3f3209ba0195989)! Thank you

HatScripts avatar Dec 01 '23 08:12 HatScripts

Oh finally a script that works 😍😍 Is it possible to add an alert that disappears after like 2/3 seconds just to know if the script worked? Because everytime i have to scroll down the page to make sure that the script worked 🥹

riccardosimo avatar Dec 01 '23 13:12 riccardosimo

@riccardosimo Could you please create a new issue for the feature request you are describing?

And please elaborate on:

  • when you want the alert to appear
  • what you mean by "scroll down the page to make sure that the script worked"

HatScripts avatar Dec 02 '23 02:12 HatScripts