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

Setting thumbanail #22

Merged
merged 1 commit into from
Jul 11, 2021
Merged
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
11 changes: 10 additions & 1 deletion upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ async function uploadVideo (videoJSON) {
const playlistName = videoJSON.playlist ? videoJSON.playlist.name : null
const createplaylistbool = videoJSON.playlist ? videoJSON.playlist.create : null
const videoLang = videoJSON.language

const thumb = videoJSON.thumbnail
await page.evaluate(() => { window.onbeforeunload = null })
await page.goto(uploadURL)

Expand Down Expand Up @@ -327,6 +327,15 @@ async function uploadVideo (videoJSON) {
// Wait for upload to go away and processing to start
await page.waitForXPath('//*[contains(text(),"Upload complete")]', { hidden: true, timeout: 0 })
// Wait until title & description box pops up
if(thumb){
const [thumbChooser] = await Promise.all([
page.waitForFileChooser(),
await page.waitForSelector(`[class="remove-default-style style-scope ytcp-thumbnails-compact-editor-uploader"]`),
await page.click(`[class="remove-default-style style-scope ytcp-thumbnails-compact-editor-uploader"]`)
])
await thumbChooser.accept([thumb])
}

await page.waitForFunction('document.querySelectorAll(\'[id="textbox"]\').length > 1')
const textBoxes = await page.$x('//*[@id="textbox"]')
await page.bringToFront()
Expand Down