zyt.uploader
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

ZYT Uploader

Youtube video uploader

npm version


🚨important : This is not the final version, I did it just as a provisional, In case you find any issue, please raise an issue, So that I can fix it.

Please star this repo by clicking on ⭐ button above ↗️

ZytUploader is a Node.js library that simplifies the process of uploading videos to YouTube without the limitations of the Google API. This library, written in TypeScript, utilizes Puppeteer for automation.

Features:

  • No upload Limits (50+ videos/day limit set by youtube for every channel)
  • Free & Easy to use

Prerequisite:

Installation:

npm i zyt-uploader

Usage:

To use zyt-uploader, follow these steps:

Import the ZytUploader class and create an instance:

const { ZytUploader } = require('zyt-uploader');
const zytUploader = new ZytUploader();

Authenticate and load cookies:

const credentialsFile = 'youtubeCredentials.json';
const loginParams = {
    email: 'your email',
    password: 'your password',
    launchOptions: {
        headless: false,
    },
};

await zytUploader.loadCookiesFromFile(credentialsFile).catch(async (e) => {
    await zytUploader.loginAndGetCookies(loginParams);
    await zytUploader.saveCookiesOnDisk(credentialsFile);
});

Check if cookies are valid and re-authenticate if necessary:

const cookieIsValid = await zytUploader.cookiesIsValid();
if (!cookieIsValid) {
    await zytUploader.loginAndGetCookies(loginParams);
}

Upload a video using the uploadVideo method:

const videoUrl = await zytUploader.uploadVideo({
    videoPath: 'video.mp4',
    title: '👩‍💻 Video uploaded by zyt-uploader',
    description: 'zyt-upload project: https://github.com/zaacksb/zyt-uploader',
    thumbnailPath: 'thumbnail.jpg',
    tags: ['nodejs', 'zyt'],
    visibility: 'unlisted',
    launchOptions: {
        headless: 'new',
    },
});

set up event listeners for progress, logs, errors, daily limit, and upload completion:

zytUploader.on('progress', ({action, percentage, remainingTime}) => {
    console.log({action, percentage, remainingTime});
});

zytUploader.on('progressText', (progress) => {
    console.log(`Event progress: ${progress}`);
});

zytUploader.on('logs', (log) => {
    console.log(log);
});

zytUploader.on('dailyLimit', (message) => {
    console.log(message);
});

zytUploader.on('error', (error) => {
    console.log(error);
});

zytUploader.on('uploaded', (url) => {
    console.log(`Video uploaded: ${url}`);
});

Additional Information

To see the browser window during execution, use headless: false. For headless operation, use headless: "new".

You can monitor the progress of the upload using the 'progress' event, which provides information about the action, percentage, and remaining time.

The 'logs' event logs all messages during the process.

The 'error' event provides error information, including codes and messages.

The 'dailyLimit' event notifies you if you reach the daily upload limit on YouTube.

The 'uploaded' event is triggered when the entire upload process is complete, providing the URL of the uploaded video.

License

This library is distributed under the MIT license. Feel free to use, modify, and distribute it as needed.

For more details, check out the zyt-uploader GitHub repository.

Based on the youtube-uploader library by fawazahmed0


Package Sidebar

Install

npm i zyt.uploader

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

81.9 kB

Total Files

20

Last publish

Collaborators

  • zacksb