yt-unlimited
v1.0.1
Published
<p align="center"> <img src="https://janusmarcin.pl/icon.svg"/> </p>
Downloads
3
Readme
Youtube Unlimited
JavaScript tool which allows you to upload videos bypassing youtube API limit of 6 uploads per 24h.
Getting Started
This script uses headless browser to run tasks, so you need few things to make it work first.
Requirements
- Install FireFox on your machine.
- Download Geckodriver and add it your system PATH
Installation
You can use it as a regular package:
npm install yt-unlimited
Or you can clone this repo to run it from CLI
First Run
If you are running this script for the first time it will ask you to login on YouTube.
FireFox window should open:
- Please navigate to youtube.com if not redirected already.
- Login to your account.
- Do not close the browser.
- When successfully logged in go back tour terminal and press Enter.
- File youtube_cookies.json should be created. Read important note below.
If you have problems with youtube login like for ex. "This browser is not secure" try navigate to other site with google auth (https://stackoverflow.com/ will do) login via google and navigate back to youtube. You should be logged in. You can now press enter in your terminal.
IMPORTANT
Do not share youtube_cookies.json file with anybody or do not add it to any git repo. This is your youtube account credentials for authentication.
Usage
YTUnlimited function returns promise with video id.
NPM Package
import YTUnlimited from 'yt-unlimited';
YTUnlimited('video.mp4', {
VIDEO_TITLE: 'Video Title',
VIDEO_DESCRIPTION: 'Video Description',
VIDEO_VISIBILITY: 'PRIVATE',
VIDEO_MADE_FOR_KIDS: false,
VIDEO_CATEGORY: 'CREATOR_VIDEO_CATEGORY_PETS',
VIDEO_TAGS: ['cats', 'pets'],
});
CLI
node dist/index.js video.mp4
For video details edit /dist/video_metadata.json file.
Options
type ConfigType = {
VIDEO_TITLE: string;
VIDEO_DESCRIPTION: string;
VIDEO_VISIBILITY: 'PUBLIC' | 'UNLISTED' | 'PRIVATE';
VIDEO_MADE_FOR_KIDS: boolean;
VIDEO_CATEGORY: VideoCategoriesType;
VIDEO_TAGS: string[];
}
enum VideoCategoriesType {
Film = 'CREATOR_VIDEO_CATEGORY_FILM',
Autos = 'CREATOR_VIDEO_CATEGORY_AUTOS',
Music = 'CREATOR_VIDEO_CATEGORY_MUSIC',
Pets = 'CREATOR_VIDEO_CATEGORY_PETS',
Sports = 'CREATOR_VIDEO_CATEGORY_SPORTS',
Travel = 'CREATOR_VIDEO_CATEGORY_TRAVEL',
Gadgets = 'CREATOR_VIDEO_CATEGORY_GADGETS',
People = 'CREATOR_VIDEO_CATEGORY_PEOPLE',
Comedy = 'CREATOR_VIDEO_CATEGORY_COMEDY',
Entertainment = 'CREATOR_VIDEO_CATEGORY_ENTERTAINMENT',
News = 'CREATOR_VIDEO_CATEGORY_NEWS',
HowTo = 'CREATOR_VIDEO_CATEGORY_HOWTO',
Education = 'CREATOR_VIDEO_CATEGORY_EDUCATION',
Science = 'CREATOR_VIDEO_CATEGORY_SCIENCE',
Goverment = 'CREATOR_VIDEO_CATEGORY_GOVERNMENT',
}
StepByStep Installation on Ubuntu 18.04
Install FireFox
sudo apt install firefox
Install Geckodriver
- Go to Geckodriver repo check latest release number in my case it is 0.28.0 and download it with command for example:
- wget https://github.com/mozilla/geckodriver/releases/download/v0.28.0/geckodriver-v0.28.0-linux64.tar.gz
- Extract: tar -xvzf geckodriver*
- Make it executable: chmod +x geckodriver
- Move it to your PATH folder: sudo mv geckodriver /usr/local/bin/
Clone this repo and run npm install
git clone https://github.com/schriker/yt-unlimited.git
npm install
Run
Before uploading video you have to be authenticated youtube user. Please check First Run section for more details. If you are running this script on remote server via SSH it will throw an error trying to open browser. Solution is to run this script first on your local machine (where browser can be opened and you can log in) to obtain youtube_cookies.json file and then copy that file to your remote server.
node dist/index.js video.mp4
Docker
You can mount your cookies and video file in docker-compose.yaml:
volumes:
- ./video.mp4:/home/app/video.mp4
- ./youtube_cookies.json:/home/app/youtube_cookies.json
And run to start conatiner and upload video:
docker-compose up