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

feat: grab the share button by the icon #89

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/constants/utils/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export const shareButtonSelector =
"#actions-inner #top-level-buttons-computed ytd-button-renderer button";
export const shareButtonSelector2 =
"#actions-inner #top-level-buttons-computed yt-button-view-model button";
export const shareButtonSelector3 =
'button:has(path[d="M15 5.63 20.66 12 15 18.37V14h-1c-3.96 0-7.14 1-9.75 3.09 1.84-4.07 5.11-6.4 9.89-7.1l.86-.13V5.63M14 3v6C6.22 10.13 3.11 15.33 2 21c2.78-3.97 6.44-6 12-6v6l8-9-8-9z"])';
export const searchButtonSelector = "#search-icon-legacy";
export const searchButtonSelector2 = "#search-icon";
2 changes: 2 additions & 0 deletions src/tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
searchButtonSelector2,
shareButtonSelector,
shareButtonSelector2,
shareButtonSelector3,
startAtContainerID,
} from "../constants/utils/queries.js";
import {
Expand Down Expand Up @@ -167,6 +168,7 @@ const clickShareButton = async (page) => {
let selector = await pollForSelector(page, [
shareButtonSelector,
shareButtonSelector2,
shareButtonSelector3,
]);
if (!selector) {
console.error("Could not find share button");
Expand Down
2 changes: 2 additions & 0 deletions src/utils/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
pollingTimeoutInSeconds,
shareButtonSelector,
shareButtonSelector2,
shareButtonSelector3,
sleepTime,
startAtContainerID,
} from "../constants/utils/queries.js";
Expand Down Expand Up @@ -169,6 +170,7 @@ export const getShareButton = async () =>
await pollForElement([
() => document.querySelector(shareButtonSelector),
() => document.querySelector(shareButtonSelector2),
() => document.querySelector(shareButtonSelector3),
]);

/**
Expand Down
Loading