README.md updated

Removed readme from YouTube folder and combined with base one along with improvements.
This commit is contained in:
aritrakarak 2021-08-24 11:27:29 +05:30
parent f674b07e22
commit 31b53d3cd6
2 changed files with 138 additions and 89 deletions

146
README.md
View File

@ -1,16 +1,146 @@
# Play-DL
# Why play-dl ?
### Why play-dl ?
[ytdl-core](https://github.com/fent/node-ytdl-core) has some issues with miniget and stream abort issues.
[ytdl-core](https://github.com/fent/node-ytdl-core) has some issues with miniget and also stream abort issues. On the other hand, [youtube-dl](https://github.com/ytdl-org/youtube-dl) is a very perfect alternative but it takes time to launch. Hence, play-dl is created to avoid these issues along with providing comparatively faster performance than others.
On other hand, youtube-dl is very perfect alternative but it takes time to launch.
### Download videos/playlists or search for videos
So I made this for better performance with no issues [as my testing].
This is a **light-weight** youtube downloader and searcher.
- searches by video, playlist, channel
- obtains audio playback url
### Installation
```
```bash
npm install play-dl@latest
```
## Examples
For examples, go to [examples](https://github.com/play-dl/play-dl/tree/main/examples) folder.
### Examples
For pre-made examples, head over to [/examples](https://github.com/play-dl/play-dl/tree/main/examples) folder.
# Basic Usage
```js
const youtube = require('play-dl');
// ES6: import youtube from 'play-dl';
const options = {
limit : 1
}
const results = await youtube.search('post malone sunflower', options);
```
# Search
### search(url : `string`, options? : [SearchOptions](https://github.com/play-dl/play-dl/tree/main/play-dl/YouTube#searchoptions))
*This enables all searching mechanism (video, channel, playlist)*
```js
const options = {
limit : 1
}
const results = await youtube.search('never gonna give you up', options);
console.log(results[0].url);
```
- #### SearchOptions
- *type* : `video` | `channel` | `playlist`
- *limit* : `integer`
# Video
### video_basic_info(url : `string`)
*The basic video details `play-dl` fetches at first.*
```js
const video = await video_basic_info(url)
```
### video_info(url : `string`)
*This contains everything with deciphered formats along with `video_details`.*
```js
const video = await video_info(url)
```
- #### format `property`
*This returns all the formats available for a video.*
```js
const video = await video_info(url)
console.log(video.format)
```
# Playlist
### playlist_info(url : `string`)
*This fetches all details about a playlist.*
```js
const playlist = await playlist_info(url)
//This only fetches first 100 videos from a playlist
```
- #### fetch() `method`
*This fetches and returns all videos from the whole provided playlist .*
```js
const playlist = await playlist_info(url)
//This only fetches first 100 videos from a playlist
await playlist.fetch()
// This one fetches all videos from a playlist.
```
- #### page(page_number : `number`)
*This returns no. of videos from a page.*
> Every 100 videos have been divided into pages.
> Example: There are 782 videos in a playlist, so there will be 8 pages.
```js
const playlist = await playlist_info(url);
// This only fetches first 100 videos from a playlist.
await playlist.fetch();
// This one fetches all videos from a playlist.
console.log(playlist.page(1));
// This displays first 100 videos of a playlist
- #### total_videos `property`
*This returns total no. of videos that have been fetched so far.*
```js
const playlist = await playlist_info(url)
//This only fetches first 100 videos from a playlist.
await playlist.fetch()
// This one fetches all videos from a playlist.
console.log(playlist.total_videos)
// This displays total no. of videos fetched so far.
```
- #### videoCount `property`
*This returns total no. of videos in the provided playlist.*
```js
const playlist = await playlist_info(url)
//This only fetches first 100 videos from a playlist.
await playlist.fetch()
// This one fetches all videos from a playlist.
console.log(playlist.videoCount)
// This displays total no. of videos in a playlist.
```

View File

@ -1,81 +0,0 @@
# YouTube Downloader/Search
### Downloades youtube videos, playlist and also searches song
This is a light-weight youtube downloader and searcher.
- searches by video, playlist, channel
- obtains audio playback url.
## Video commands usage :-
### 1. video_basic_info(url : `string`)
*This is what downloader gets first.*
```js
let video = await video_basic_info(url)
```
### 2. video_info(url : `string`)
*This contains everything with deciphered formats along with video_details.*
```js
let video = await video_info(url)
```
### 3. formats
*This shows all formats availiable of a video*
```js
let video = await video_info(url)
console.log(video.format)
```
## Playlist commands usage :-
### 1. playlist_info(url : `string`)
*This containes every thing about a playlist*
```js
let playlist = await playlist_info(url) //This only fetches first 100 songs from a playlist
```
#### 2. playlist.fetch()
*This fetches whole playlist.*
```js
let playlist = await playlist_info(url) //This only fetches first 100 songs from a playlist
await playlist.fetch() // This one fetches all songs from a playlist.
```
#### 3. playlist.page(page_number : `number`)
*This gives you no. of videos from a page*
> Pages : every 100 songs have been divided into pages.
> So for example: There are 782 songs in a playlist, so there will be 8 pages.
```js
let playlist = await playlist_info(url) //This only fetches first 100 songs from a playlist
await playlist.fetch() // This one fetches all songs from a playlist.
console.log(playlist.page(1)) // This displays first 100 songs of a playlist
```
#### 4. playlist.total_videos
*This tells you total no of videos that have been fetched so far.*
```js
let playlist = await playlist_info(url) //This only fetches first 100 songs from a playlist
await playlist.fetch() // This one fetches all songs from a playlist.
console.log(playlist.total_videos) // This displays total no. of videos fetched so far.
```
#### 5. playlist.videoCount
*This tells total no. of songs in a playlist.*
```js
let playlist = await playlist_info(url) //This only fetches first 100 songs from a playlist
await playlist.fetch() // This one fetches all songs from a playlist.
console.log(playlist.videoCount) // This displays total no. of videos in a playlist
```
## Search Command Usage :-
### 1. search(url : `string`, options? : [SearchOptions](https://github.com/play-dl/play-dl/tree/main/play-dl/YouTube#searchoptions))
*This enables all searching mechanism (video, channel, playlist)*
```js
let result = await search('Rick Roll')
console.log(result[0].url)
```
### SearchOptions
- Type : `video` | `channel` | `playlist`
- Limit : `number`