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

Headless doesn't work as of 01.27.2024 #240

Open
urcoolfriend opened this issue Jan 27, 2024 · 4 comments
Open

Headless doesn't work as of 01.27.2024 #240

urcoolfriend opened this issue Jan 27, 2024 · 4 comments

Comments

@urcoolfriend
Copy link

urcoolfriend commented Jan 27, 2024

Google appears to be blocking automated headless interactions. Here is the code I'm trying:


const { upload } = require('youtube-videos-uploader'); 

const credentials = { email: '[email protected]', pass: 'pass!', recoveryemail: '[email protected]' }

const video1 = { path: 'clips/post_1.mp4', title: 'story!', description: 'WOW story', channelName: 'mychannel' }

const video2 = { path: 'clips/post_2.mp4', title: 'WOOW Story!', description: 'Increadible story, channelName: 'mychannel' }

upload (credentials, [video1, video2], {headless:"new", args: ["--no-sandbox", ],}).then(console.log)

And this results in:
TimeoutError: waiting for selector input[type="password"]:not([aria-hidden="true"]) failed: timeout 60000ms exceeded
at new WaitTask (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:680:34)
at DOMWorld._waitForSelectorInPage (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:564:26)
at internalHandler.waitFor (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/QueryHandler.js:34:29)
at DOMWorld.waitForSelector (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/DOMWorld.js:493:29)
at Frame.waitForSelector (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/FrameManager.js:1019:51)
at Page.waitForSelector (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:2265:33)
at login (/usr/src/app/node_modules/youtube-videos-uploader/dist/upload.js:974:25)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async loadAccount (/usr/src/app/node_modules/youtube-videos-uploader/dist/upload.js:838:13)
at async upload (/usr/src/app/node_modules/youtube-videos-uploader/dist/upload.js:52:9)

A few ideas how to fix this:

  1. Try playing around with providing session cookies from a real session to chromium
  2. Fail back to opening an actual browser window to allow user to manually do whatever needs to be done when the script results in timeout on navigation.

But unfortunately I don't see any of the available headless selenium/firefox + puppeteer solutions as a long term strategy for automated youtube uploads as of now :( My dreams of automating mass-uploads are now completely shattered

@ali-kingX
Copy link

Yup, and even doing it with headless disabled i get this error :(
TypeError: text is not iterable
at Keyboard.type (C:\Users\laure\Desktop\Video Generator\node_modules\puppeteer\lib\cjs\puppeteer\common\Input.js:195:28)
at ElementHandle.type (C:\Users\laure\Desktop\Video Generator\node_modules\puppeteer\lib\cjs\puppeteer\common\JSHandle.js:739:79)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async DOMWorld.type (C:\Users\laure\Desktop\Video Generator\node_modules\puppeteer\lib\cjs\puppeteer\common\DOMWorld.js:487:9)
at async login (C:\Users\laure\Desktop\Video Generator\node_modules\youtube-videos-uploader\dist\upload.js:976:9)
at async loadAccount (C:\Users\laure\Desktop\Video Generator\node_modules\youtube-videos-uploader\dist\upload.js:838:13)
at async upload (C:\Users\laure\Desktop\Video Generator\node_modules\youtube-videos-uploader\dist\upload.js:52:9)

@monkeyhucker62
Copy link

Is there a work around, such as not running in headless mode? Or any other working packages?

@developerfromjokela
Copy link

developerfromjokela commented Mar 13, 2024

It's just getting recaptchas.

@dominic-findlay
Copy link

I did this to spawn the window off screen

{
      headless: false,
      userDataDir: process.env.LOCALAPPDATA + "/Google/Chrome SxS/User Data/",
      args: [
          '--profile-directory=Upload', //Select your profle here
          '--window-size=200,200',
          '--window-position=3000,3000'
      ]
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants