youtube-uploader
youtube-uploader copied to clipboard
Headless doesn't work as of 01.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:
- Try playing around with providing session cookies from a real session to chromium
- 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
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)
Is there a work around, such as not running in headless mode? Or any other working packages?
It's just getting recaptchas.