Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
przemyslawpluta committed Sep 24, 2017
1 parent 8bc4839 commit 5efbce3
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ If you're only interested in downloading only from youtube, you should consider

With [npm](https://www.npmjs.com/) do:

```
``` sh
npm install youtube-dl
```

## Usage

### Downloading videos

``` js
Expand Down Expand Up @@ -101,23 +102,22 @@ It will produce an output that looks like the following when ran.

**Output:**

```sh
[jay@macpro ~/nodejs/node-youtube-dl/example]$ node resume.js
``` sh
[~/nodejs/node-youtube-dl/example]$ node resume.js
Download started
filename: 1 1 1-179MiZSibco.mp4
size: 5109213
^C
```

```
[jay@macpro ~/nodejs/node-youtube-dl/example]$ node resume.js
``` sh
[~/nodejs/node-youtube-dl/example]$ node resume.js
Download started
filename: 1 1 1-179MiZSibco.mp4
size: 5109213
resuming from: 917504
remaining bytes: 4191709
finished downloading!
[jay@macpro ~/nodejs/node-youtube-dl/example]$
finished downloading
```

### Getting video information
Expand All @@ -142,7 +142,7 @@ youtubedl.getInfo(url, options, function(err, info) {

Running that will produce something like

```
``` sh
id: WKsjaOqDXgg
title: Ace Rimmer to the Rescue
url: http://r5---sn-p5qlsn7e.c.youtube.com/videoplayback?ms=au&ip=160.79.125.18&cp=U0hWTFVQVl9FTENONl9NSlpDOjgtU1VsODlkVmRH&id=58ab2368ea835e08&source=youtube&expire=1377558202&factor=1.25&key=yt1&ipbits=8&mt=1377534150&itag=34&sver=3&upn=-rGWz2vYpN4&fexp=912306%2C927900%2C919395%2C926518%2C936203%2C913819%2C929117%2C929121%2C929906%2C929907%2C929922%2C929127%2C929129%2C929131%2C929930%2C925726%2C925720%2C925722%2C925718%2C929917%2C906945%2C929919%2C929933%2C912521%2C932306%2C913428%2C904830%2C919373%2C930803%2C908536%2C904122%2C938701%2C936308%2C909549%2C900816%2C912711%2C904494%2C904497%2C900375%2C906001&sparams=algorithm%2Cburst%2Ccp%2Cfactor%2Cid%2Cip%2Cipbits%2Citag%2Csource%2Cupn%2Cexpire&mv=m&burst=40&algorithm=throttle-factor&signature=ABD3A847684AD9B39331E567568D3FA0DCFA4776.7895521E130A042FB3625A17242CE3C02A4460B7&ratebypass=yes
Expand Down Expand Up @@ -249,7 +249,7 @@ youtubedl.getExtractors(true, function(err, list) {

Will print something like

```
``` sh
Found 521 extractors
1up.com
220.ro
Expand All @@ -258,6 +258,7 @@ Found 521 extractors
```

### Call the `youtube-dl` binary directly

This module doesn't have `youtube-dl` download the video. Instead, it uses the `url` key from the `--dump-json` CLI option to create a node stream. That way, it can be used like any other node stream.

If that, or none of the above support your use case, you can use `ytdl.exec()` to call `youtube-dl` however you like.
Expand All @@ -270,6 +271,7 @@ ytdl.exec(url, ['-x', '--audio-format', 'mp3'], {}, function(err, output) {
```

### Update

Since the youtube-dl binary is updated regularly, you can run `npm run update` to check for and download any updates for it. You can also require `../lib/downloader` in your app if you'd like to place `youtube-dl` binary in a specific directory and control when it gets updates.

``` js
Expand All @@ -283,13 +285,15 @@ downloader('path/to-binary', function error(err, done) {
```

### Tests

Tests are written with [vows](http://vowsjs.org/)

```bash
``` sh
npm test
```

# License
## License

MIT

[youtube-dl]: http://rg3.github.com/youtube-dl/
Expand Down

0 comments on commit 5efbce3

Please sign in to comment.