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

How can I use this on a folder of videos? #230

Open
Auditormadness9 opened this issue Nov 1, 2023 · 6 comments
Open

How can I use this on a folder of videos? #230

Auditormadness9 opened this issue Nov 1, 2023 · 6 comments

Comments

@Auditormadness9
Copy link

Auditormadness9 commented Nov 1, 2023

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

const credentials = { email: '███████████████@gmail.com', pass: '███████████████', recoveryemail: '███████████████@gmail.com' }

function getFilesFromDir(startPath) {
    let results = [];
    const files = fs.readdirSync(startPath);

    for (let i = 0; i < files.length; i++) {
        const filePath = path.join(startPath, files[i]);
        const stat = fs.statSync(filePath);
        if (stat && stat.isDirectory()) {
            results = results.concat(getFilesFromDir(filePath));
        } else {
            results.push({ path: filePath, creationTime: stat.birthtime });
        }
    }
    return results;
}

const videoFiles = getFilesFromDir('D:\\Videos');

videoFiles.sort((a, b) => a.creationTime - b.creationTime);

const videosToUpload = videoFiles.map(file => ({
    path: file.path,
    title: path.basename(file.path),
    description: ''
}));

upload(credentials, videosToUpload).then(console.log);

this is my current code but it throws error:

S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:173
        throw new Error('Daily upload limit reached');
              ^

Error: Daily upload limit reached
    at uploadVideo (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:173:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:49:26)
@Auditormadness9
Copy link
Author

Goes to youtube and returns this:

Error: net::ERR_ABORTED at https://www.youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en
    at navigate (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:195:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:171:21)
    at async Frame.goto (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:584:16)
    at async Page.goto (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1109:16)
    at async changeHomePageLangIfNeeded (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:847:9)
    at async loadAccount (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:791:9)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:46:9)
Error: net::ERR_ABORTED at https://www.youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en
    at navigate (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:195:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:171:21)
    at async Frame.goto (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:584:16)
    at async Page.goto (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1109:16)
    at async changeHomePageLangIfNeeded (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:847:9)
    at async loadAccount (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:791:9)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:46:9)
S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:195
                    ? new Error(`${response.errorText} at ${url}`)
                      ^

Error: net::ERR_ABORTED at https://www.youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en
    at navigate (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:195:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async FrameManager.navigateFrame (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:171:21)
    at async Frame.goto (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:584:16)
    at async Page.goto (S:\yt\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1109:16)
    at async login (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:887:5)
    at async loadAccount (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:795:9)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:46:9)
    ```

@pm96
Copy link

pm96 commented Nov 11, 2023

The error message you link to is very clear about what the issue is: "Daily upload limit reached". Have you already uploaded a large amount of videos the day you had this issue?
Could it be something relating to unverified accounts?

@Auditormadness9
Copy link
Author

Auditormadness9 commented Nov 11, 2023

right now i am verified, have not reached the daily upload limit, and still receive the abort error. It just goes to either the uplaod screen or the main youtube page and just either times out or aborts itself.

currently goes to https://studio.youtube.com/channel/UC2v4TQHa21uJq6Zv0RtDSig/videos/upload?hl=en&d=ud&filter=%5B%5D&sort=%7B%22columnType%22%3A%22date%22%2C%22sortOrder%22%3A%22DESCENDING%22%7D and just stays there, not doing anything

code:

const upload = require('youtube-videos-uploader').upload;
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
puppeteer.use(StealthPlugin());

const credentials = { email: '████████████', pass: '██████████████', recoveryemail: 'Your Recovery Email' }
const video1 = { path: '9A6BCC0.mp4', title: '9A6BCC0.mp4', description: '' }



// Extra options like tags, thumbnail, language, playlist etc
// const video2 = { path: 'video2.mp4', title: 'title 2', description: 'description 2', thumbnail:'thumbnail.png', language: 'english', tags: ['video', 'github'], playlist: 'playlist name', channelName: 'Channel Name', onSuccess:onVideoUploadSuccess, skipProcessingWait: true, onProgress: (progress) => { console.log('progress', progress) }, uploadAsDraft: false, isAgeRestriction: false, isNotForKid: false, publishType: 'PUBLIC', isChannelMonetized: false }


// Returns uploaded video links in array
upload (credentials, [video1]).then(console.log)

// OR
// This package uses Puppeteer, you can also pass Puppeteer launch configuration
upload (credentials, [video1], {headless:false}).then(console.log)

// Refer Puppeteer documentation for more launch configurations like proxy etc
// https://pptr.dev/#?product=Puppeteer&version=main&show=api-puppeteerlaunchoptions

that video is in the same directory as the one this script is in/is running from.

@pm96
Copy link

pm96 commented Nov 11, 2023

What is the size and length of the video. Youtube has restriction for those as well.
It goes just fine uploading the video manually?

@Auditormadness9
Copy link
Author

Auditormadness9 commented Nov 11, 2023

65.5 MB, 14 mins, completely fine manually.

It literally times out at this screen:

image

@Auditormadness9
Copy link
Author

Auditormadness9 commented Nov 11, 2023

many other times it can't even get to that page, just launches the main page youtube.com and seems to have trouble finding a selector or smth, and terminates itself with the error:

Error: net::ERR_ABORTED at https://www.youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en
    at navigate (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:175:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Deferred.race (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\util\Deferred.js:83:20)
    at async CdpFrame.goto (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:141:25)
    at async CdpPage.goto (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Page.js:724:20)
    at async changeHomePageLangIfNeeded (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:848:9)
    at async loadAccount (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:792:9)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:46:9)
Error: net::ERR_ABORTED at https://www.youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en
    at navigate (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:175:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Deferred.race (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\util\Deferred.js:83:20)
    at async CdpFrame.goto (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:141:25)
    at async CdpPage.goto (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Page.js:724:20)
    at async changeHomePageLangIfNeeded (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:848:9)
    at async loadAccount (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:792:9)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:46:9)
S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:175
                        ? new Error(`${response.errorText} at ${url}`)
                          ^

Error: net::ERR_ABORTED at https://www.youtube.com/upload?persist_gl=1&gl=US&persist_hl=1&hl=en
    at navigate (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:175:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Deferred.race (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\util\Deferred.js:83:20)
    at async CdpFrame.goto (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\cdp\Frame.js:141:25)
    at async CdpPage.goto (S:\yt\node_modules\puppeteer-core\lib\cjs\puppeteer\api\Page.js:724:20)
    at async login (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:888:5)
    at async loadAccount (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:796:9)
    at async upload (S:\yt\node_modules\youtube-videos-uploader\dist\upload.js:46:9)

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

2 participants