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

build workflow and support monetization score step #205

Merged
merged 2 commits into from
Mar 14, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build

on:
pull_request:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm ci
- name: Build
run: npm run build
45 changes: 38 additions & 7 deletions src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,11 @@ async function uploadVideo(videoJSON: Video, messageTransport: MessageTransport)
const nextBtnXPath = "//*[normalize-space(text())='Next']/parent::*[not(@disabled)]"
let next

if (videoJSON.isChannelMonetized) { // Always enable monetization if channel is monetized
await page.waitForXPath(nextBtnXPath);
next = await page.$x(nextBtnXPath);
await next[0].click();
await page.waitForXPath(nextBtnXPath);
next = await page.$x(nextBtnXPath);
await next[0].click();

if (videoJSON.isChannelMonetized) { // Always enable monetization if channel is monetized
await page.waitForSelector("#child-input ytcp-video-monetization", { visible: true });

await page.waitForTimeout(1500);
Expand All @@ -359,11 +359,42 @@ async function uploadVideo(videoJSON: Video, messageTransport: MessageTransport)
await page.click(
"ytcp-video-monetization-edit-dialog.cancel-button-hidden .ytcp-video-monetization-edit-dialog #save-button"
);

await page.waitForTimeout(1500);

await page.waitForXPath(nextBtnXPath);
next = await page.$x(nextBtnXPath);
await next[0].click();

try {
await page.waitForSelector(
".ytpp-self-certification-questionnaire .ytpp-self-certification-questionnaire #checkbox-container",
{ visible: true, timeout: 10000 }
);
await page.evaluate(() =>
//@ts-ignore
document.querySelector(".ytpp-self-certification-questionnaire .ytpp-self-certification-questionnaire #checkbox-container").click()
);

await page.waitForTimeout(1500);

await page.waitForSelector(
".ytpp-self-certification-questionnaire .ytpp-self-certification-questionnaire #submit-questionnaire-button",
{ visible: true }
);
await page.evaluate(() =>
//@ts-ignore
document.querySelector(".ytpp-self-certification-questionnaire .ytpp-self-certification-questionnaire #submit-questionnaire-button").click()
);

await page.waitForXPath(nextBtnXPath);
next = await page.$x(nextBtnXPath);
await next[0].click();

await page.waitForTimeout(1500);
} catch {}
ClassAxion marked this conversation as resolved.
Show resolved Hide resolved
}

await page.waitForXPath(nextBtnXPath)
next = await page.$x(nextBtnXPath)
await next[0].click()
// await sleep(2000)
await page.waitForXPath(nextBtnXPath)
// click next button
Expand Down