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

Fix "Couldn't sign you in" Google login errors #127

Merged
merged 3 commits into from Jul 9, 2022
Merged
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
10 changes: 6 additions & 4 deletions src/upload.ts
Expand Up @@ -12,8 +12,10 @@ const rl = readline.createInterface({
});
const prompt = (query: string) => new Promise<string>((resolve) => rl.question(query, resolve));

const StealthPlugin = require('puppeteer-extra-plugin-stealth')
puppeteer.use(StealthPlugin())
const StealthPlugin = require('puppeteer-extra-plugin-stealth')()
StealthPlugin.enabledEvasions.delete('iframe.contentWindow')
StealthPlugin.enabledEvasions.delete('navigator.plugins')
puppeteer.use(StealthPlugin)

const maxTitleLen = 100
const maxDescLen = 5000
Expand Down Expand Up @@ -101,11 +103,11 @@ async function uploadVideo(videoJSON: Video) {
const saveCloseBtnXPath = '//*[@aria-label="Save and close"]/tp-yt-iron-icon'
const createBtnXPath = '//*[@id="create-icon"]/tp-yt-iron-icon'
const addVideoBtnXPath = '//*[@id="text-item-0"]/ytcp-ve/div/div/yt-formatted-string'
if((await page.waitForXPath(createBtnXPath))){
if((await page.waitForXPath(createBtnXPath).catch(() => null))){
const createBtn = await page.$x(createBtnXPath);
await createBtn[0].click();
}
if((await page.waitForXPath(addVideoBtnXPath))){
if((await page.waitForXPath(addVideoBtnXPath).catch(() => null))){
const addVideoBtn =await page.$x(addVideoBtnXPath);
await addVideoBtn[0].click();
}
Expand Down