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

New selectors for like and dislike buttons, plus for shorts #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions youtube-auto-liker.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @name:zh YouTube自動點讚
// @name:ja YouTubeのような自動
// @namespace https://github.com/HatScripts/youtube-auto-liker
// @version 1.3.26
// @version 1.3.27
// @description Automatically likes videos of channels you're subscribed to
// @description:zh 對您訂閲的頻道視頻自動點讚
// @description:ja 購読しているチャンネルの動画が自動的に好きです
Expand Down Expand Up @@ -100,9 +100,9 @@

const SELECTORS = {
PLAYER: '#movie_player',
SUBSCRIBE_BUTTON: '#subscribe-button > ytd-subscribe-button-renderer',
LIKE_BUTTON: '#menu #top-level-buttons-computed > ytd-toggle-button-renderer:nth-child(1), #segmented-like-button button',
DISLIKE_BUTTON: '#menu #top-level-buttons-computed > ytd-toggle-button-renderer:nth-child(2), #segmented-dislike-button button'
SUBSCRIBE_BUTTON: '#subscribe-button > ytd-subscribe-button-renderer, #subscribe-button-shape button.yt-spec-button-shape-next--tonal',
LIKE_BUTTON: '.YtLikeButtonViewModelHost button, #like-button button',
DISLIKE_BUTTON: '.YtDislikeButtonViewModelHost button, #dislike-button button',
}

const autoLikedVideoIds = []
Expand Down Expand Up @@ -140,7 +140,7 @@
if (!subscribeButton) {
throw Error('Couldn\'t find sub button')
}
const subscribed = subscribeButton.hasAttribute('subscribe-button-invisible')
const subscribed = subscribeButton.hasAttribute('subscribe-button-invisible') || subscribeButton.classList.contains('yt-spec-button-shape-next--tonal')
DEBUG.info(subscribed ? 'We are subscribed' : 'We are not subscribed')
return subscribed
}
Expand Down