Skip to content

Commit

Permalink
Merge pull request #22 from TentacleSama4254/patch-1
Browse files Browse the repository at this point in the history
Setting thumbanail
  • Loading branch information
fawazahmed0 committed Jul 11, 2021
2 parents b8d3163 + 65beb46 commit 3fc902a
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 3fc902a

Please sign in to comment.