Skip to content

Commit

Permalink
Merge pull request #205 from ClassAxion/main
Browse files Browse the repository at this point in the history
build workflow and support monetization score step
  • Loading branch information
fawazahmed0 committed Mar 14, 2023
2 parents d04d118 + b033e60 commit caaf231
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 7 deletions.
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 {}
}

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

0 comments on commit caaf231

Please sign in to comment.