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

Typescript rewrite + Save cookies(LoginInfo) #51

Merged
merged 15 commits into from
Oct 27, 2021
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,4 @@ dist
*.mp4
test.js
thumbnail.png
yt-auth/
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 120,
"tabWidth": 4
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">Youtube Videos Uploader</h1>

<p align="center">
<img width="460" height="300" src="https://github.com/fawazahmed0/youtube-uploader/raw/main/youtube.png">
<img width="460" height="300" src="assets/youtube.png">

[![npm version](https://img.shields.io/npm/v/youtube-videos-uploader.svg?style=flat)](https://www.npmjs.com/package/youtube-videos-uploader)

Expand All @@ -12,7 +12,7 @@
Please star this repo by clicking on [:star: button](#) above [:arrow_upper_right:](#)

### Features:
- No upload Limits (100 videos/day limit set by youtube for every channel)
- No upload Limits (50+ videos/day limit set by youtube for every channel)
- Free & Easy to use

### Prerequisite:
Expand All @@ -28,7 +28,7 @@ npm i youtube-videos-uploader
2. Go to your [Youtube settings](https://studio.youtube.com/) and Setup your upload defaults Settings:


![Upload Defaults Settings](https://github.com/fawazahmed0/youtube-uploader/raw/main/defaultsettings.png)
![Upload Defaults Settings](assets/defaultsettings.png)



Expand Down Expand Up @@ -68,7 +68,7 @@ upload (credentials, [video1, video2], {headless:false}).then(console.log)

### Contributors 🎉:
- [Pierre Miniggio( @pierreminiggio )](https://ggio.link/twitter) - For Adding [Youtube UI English Language Support](https://github.com/fawazahmed0/youtube-uploader/pull/16), [JSDoc](https://github.com/fawazahmed0/youtube-uploader/pull/18), and [debug message](https://github.com/fawazahmed0/youtube-uploader/pull/34)
- [TentacleSama4254 ](https://github.com/TentacleSama4254) - For Adding [Thumbnail option](https://github.com/fawazahmed0/youtube-uploader/pull/22) and fixing [tags error](https://github.com/fawazahmed0/youtube-uploader/pull/23)
- [TentacleSama4254 ](https://github.com/TentacleSama4254) - For Adding [Thumbnail option](https://github.com/fawazahmed0/youtube-uploader/pull/22), fixing [tags error](https://github.com/fawazahmed0/youtube-uploader/pull/23), [TypeScript Rewrite and storing login session](https://github.com/fawazahmed0/youtube-uploader/pull/51)
- [Sai Charan](https://github.com/charan0017) - For [onSuccess Option](https://github.com/fawazahmed0/youtube-uploader/pull/32)
- [Tue Nguyen](https://github.com/TueNguyen2911) - For [Better error messages](https://github.com/fawazahmed0/youtube-uploader/pull/46)
- [weizhiqimail](https://github.com/weizhiqimail) - For [Extra Debug messages](https://github.com/fawazahmed0/youtube-uploader/pull/47)
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
58 changes: 57 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 22 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,32 @@
"name": "youtube-videos-uploader",
"version": "1.3.25",
"description": "Uploads videos to youtube without any limits",
"main": "upload.js",
"main": "dist/index.js",
"types": "dist",
"files": [
"dist",
"auth",
"test"
],
"directories": {
"test": "test"
},
"dependencies": {
"prettier": "^2.4.1",
"puppeteer": "latest",
"puppeteer-extra": "latest",
"puppeteer-extra-plugin-stealth": "latest"
"puppeteer-extra-plugin-stealth": "latest",
"typescript": "^4.4.4"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fawazahmed0/youtube-uploader.git"
},
"scripts": {
"build": "tsc -p .",
"prepublish": "npm run build",
"format": "prettier --config .prettierrc \"src/**/*.ts\" --write"
},
"keywords": [
"youtube uploader",
"No limits",
Expand All @@ -28,5 +44,8 @@
"bugs": {
"url": "https://github.com/fawazahmed0/youtube-uploader/issues"
},
"homepage": "https://github.com/fawazahmed0/youtube-uploader#readme"
"homepage": "https://github.com/fawazahmed0/youtube-uploader#readme",
"devDependencies": {
"@types/fs-extra": "^9.0.13"
}
}
22 changes: 22 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export * from './upload'

/*
Usage:
const { upload } = require('youtube-videos-uploader');
// recoveryemail is optional, only required to bypass login with recovery email if prompted for confirmation
const credentials = { email: 'email', pass: 'pass', recoveryemail: 'recoveryemail' }
// minimum required options to upload video
const video1 = { path: 'video1.mp4', title: 'title 1', description: 'description 1' }
const onVideoUploadSuccess = (videoUrl) => {
// ..do something..
}
// 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', onSuccess:onVideoUploadSuccess }
// Returns uploaded video links in array
upload (credentials, [video1, video2]).then(console.log)
// OR
// This package uses Puppeteer, you can also pass Puppeteer launch configuration
upload (credentials, [video1, video2], {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
*/
17 changes: 17 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface Video {
path: string
title: string
description: string
tags?: string[]
language?: string
playlist?: string
function?: any
thumbnail?: string
onSuccess?: Function
}

export interface Credentials {
email: string
pass: string
recoveryemail?: string | undefined
}