yt-converter
Advanced tools
Comparing version 1.3.5 to 2.0.0
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es2021": true | ||
@@ -10,25 +9,31 @@ }, | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 13 | ||
"ecmaVersion": 13, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"linebreak-style": [ | ||
"linebreak-style":["error","unix"], | ||
"import/extensions": [ | ||
"error", | ||
"unix" | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"jsx": "never", | ||
"ts": "never", | ||
"tsx": "never" | ||
} | ||
], | ||
"quotes": [ | ||
"error", | ||
"double" | ||
], | ||
"no-console":"off", | ||
"semi": "off", | ||
"eol-last": "off", | ||
"no-multiple-empty-lines":"off", | ||
"indent":["error",4], | ||
"max-len":"off", | ||
"comma-dangle":"off", | ||
"no-trailing-spaces":"off", | ||
"no-async-promise-executor":"off", | ||
"default-param-last":"off" | ||
"no-unused-vars":"warn" | ||
}, | ||
"settings": { | ||
"import/resolver":{ | ||
"node":{ | ||
"extensions":[".js",".ts"] | ||
} | ||
} | ||
} | ||
} |
{ | ||
"name": "yt-converter", | ||
"version": "1.3.5", | ||
"version": "2.0.0", | ||
"description": "A youtube video converter for mp3 and mp4 using node-ytdl and ffmpeg", | ||
"main": "./src/index.js", | ||
"main": "dist/src/index.js", | ||
"scripts": { | ||
"build": "jsdoc -r src -t node_modules/tsd-jsdoc/dist -d lib", | ||
"prepublishOnly": "jsdoc -r src -t node_modules/tsd-jsdoc/dist -d lib" | ||
"build": "tsc", | ||
"prepublish": "tsc" | ||
}, | ||
@@ -22,12 +22,14 @@ "keywords": [ | ||
"ffmpeg-static": "^4.4.0", | ||
"tsd-jsdoc": "^2.5.0", | ||
"ytdl-core": "^4.11.3" | ||
}, | ||
"types": "lib/index.d.ts", | ||
"types": "dist/types.d.ts", | ||
"devDependencies": { | ||
"eslint": "^8.5.0", | ||
"@typescript-eslint/eslint-plugin": "^6.17.0", | ||
"@typescript-eslint/parser": "^6.17.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-plugin-import": "^2.25.3", | ||
"typescript": "^5.0.4", | ||
"yt-converter": "^1.3.0" | ||
"eslint-config-airbnb-typescript": "^17.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.3.3" | ||
}, | ||
@@ -34,0 +36,0 @@ "repository": { |
# Node YoutubeDL - Easy to use downloader for YouTube videos | ||
> [!IMPORTANT] | ||
> Version 2.0 Released. New way to use it. | ||
## Installation | ||
@@ -9,44 +12,55 @@ ```bash | ||
## Usage | ||
### Get Info from a video | ||
```js | ||
const yt = require("yt-converter"); | ||
yt.getInfo("https://www.youtube.com/watch?v=dQw4w9WgXcQ").then(info => { | ||
console.log(info); | ||
}); | ||
There's two ways to use this library, convert audio or video. For this the package exports two functions named Audio, and Video, each one is for convert audio and video respectively. | ||
### Converting Youtube Video to MP3 file | ||
```ts | ||
import { Video, Audio } from '../dist/src/index'; | ||
const link = 'https://www.youtube.com/watch?v=QI5idh3Uwh4&list=RDQI5idh3Uwh4&start_radio=1'; | ||
async function test(url:string) { | ||
const data = await Audio({ | ||
url, | ||
onDownloading: (d) => console.log(d), | ||
}); | ||
console.log(data.message); | ||
} | ||
test(link); | ||
``` | ||
Info represents the video information: | ||
- **title** | ||
- **author** | ||
- **thumbnails** | ||
- **formats** | ||
- Contains the available formats for the video in an array | ||
- The object has the property itag which can be used to convert the video | ||
- **formatsAudio** | ||
- **formatsVideo** | ||
### Converting Youtube Video to MP4 file | ||
### Download a video format mp4 | ||
```js | ||
const yt = require("yt-converter"); | ||
yt.convertVideo({ | ||
url: "https://www.youtube.com/watch?v=JzbGrvkqV5w", | ||
itag: 136, | ||
directoryDownload: __dirname, | ||
title: "Your title here" | ||
}, onData, onClose) | ||
```ts | ||
import { Video, Audio } from '../dist/src/index'; | ||
const link = 'https://www.youtube.com/watch?v=QI5idh3Uwh4&list=RDQI5idh3Uwh4&start_radio=1'; | ||
async function test(url:string) { | ||
const data = await Video({ | ||
url, | ||
onDownloading: (d) => console.log(d), | ||
}); | ||
console.log(data.message); | ||
} | ||
test(link); | ||
``` | ||
### Function params | ||
### Download a video format mp3 | ||
```js | ||
const yt = require("yt-converter"); | ||
yt.convertAudio({ | ||
url: "https://www.youtube.com/watch?v=JzbGrvkqV5w", | ||
itag: 140, | ||
directoryDownload: __dirname, | ||
title: "Your title here" | ||
},onData,onClose) | ||
``` | ||
- **itag**: [itag]("https://en.wikipedia.org/wiki/YouTube#Quality_and_formats") represent an number of video format | ||
- **path**: path to save the file | ||
- **onData**: callback function that is executed everytime while the file is converted | ||
- **onClose**: callback function when the conversion is finished | ||
Both fuctions need an options object. | ||
* *url*: Expect to be a string representing the url link of the youtube video. | ||
* *directory (optional)*: Path relative where you want the file converted. | ||
* *itag*: This represents a number of a specific format. [For more information](https://en.wikipedia.org/wiki/YouTube#Quality_and_formats) | ||
* *onDownloading (optional)* : Function will be executed while the file is downloading. | ||
Once the functions Video and Audio are executed, returns a promise wich resolve a data object. | ||
* *message* | ||
* *error* | ||
* *videoInfo* |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37138
3
28
803
65
8
3
- Removedtsd-jsdoc@^2.5.0
- Removed@babel/helper-string-parser@7.25.9(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@babel/parser@7.26.2(transitive)
- Removed@babel/types@7.26.0(transitive)
- Removed@types/linkify-it@5.0.0(transitive)
- Removed@types/markdown-it@12.2.3(transitive)
- Removed@types/mdurl@2.0.0(transitive)
- Removedargparse@2.0.1(transitive)
- Removedbluebird@3.7.2(transitive)
- Removedcatharsis@0.9.0(transitive)
- Removedentities@2.1.0(transitive)
- Removedescape-string-regexp@2.0.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjs2xmlparser@4.0.2(transitive)
- Removedjsdoc@3.6.11(transitive)
- Removedklaw@3.0.0(transitive)
- Removedlinkify-it@3.0.3(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmarkdown-it@12.3.2(transitive)
- Removedmarkdown-it-anchor@8.6.7(transitive)
- Removedmarked@4.3.0(transitive)
- Removedmdurl@1.0.1(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedrequizzle@0.2.4(transitive)
- Removedstrip-json-comments@3.1.1(transitive)
- Removedtaffydb@2.6.2(transitive)
- Removedtsd-jsdoc@2.5.0(transitive)
- Removedtypescript@3.9.10(transitive)
- Removeduc.micro@1.0.6(transitive)
- Removedunderscore@1.13.7(transitive)
- Removedxmlcreate@2.0.4(transitive)