ytdl-core
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -37,2 +37,10 @@ var urllib = require('url'); | ||
} | ||
if (!callback) { | ||
return new Promise(function(resolve, reject) { | ||
getInfo(link, options, function(err, info) { | ||
if (err) return reject(err); | ||
resolve(info); | ||
}); | ||
}); | ||
} | ||
@@ -156,11 +164,2 @@ var myrequest = options.request || request; | ||
if (info.video_verticals) { | ||
info.video_verticals = info.video_verticals | ||
.slice(1, -1) | ||
.split(', ') | ||
.filter(function(val) { return val !== ''; }) | ||
.map(function(val) { return parseInt(val, 10); }) | ||
; | ||
} | ||
info.formats = util.parseFormats(info); | ||
@@ -167,0 +166,0 @@ |
@@ -8,5 +8,2 @@ var fs = require('fs'); | ||
var VIDEO_URL = 'https://www.youtube.com/watch?v='; | ||
/** | ||
@@ -237,3 +234,2 @@ * Extract signature deciphering tokens from html5player file. | ||
var query = parsedUrl.query; | ||
query.ratebypass = 'yes'; | ||
if (sig) { | ||
@@ -240,0 +236,0 @@ query.signature = sig; |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"repository": { | ||
@@ -33,3 +33,6 @@ "type": "git", | ||
}, | ||
"engines": { | ||
"node": ">=0.12" | ||
}, | ||
"license": "MIT" | ||
} |
# node-ytdl-core | ||
Yet another youtube downloading module. This time written with only Javascript and a more node-friendly streaming interface. | ||
Yet another youtube downloading module. Written with only Javascript and a node-friendly streaming interface. | ||
[![Build Status](https://secure.travis-ci.org/fent/node-ytdl-core.svg)](http://travis-ci.org/fent/node-ytdl-core) | ||
[![Dependency Status](https://gemnasium.com/fent/node-ytdl-core.svg)](https://gemnasium.com/fent/node-ytdl-core) | ||
[![Dependency Status](https://david-dm.org/fent/node-ytdl-core.svg)](https://david-dm.org/fent/node-ytdl-core) | ||
[![codecov](https://codecov.io/gh/fent/node-ytdl-core/branch/master/graph/badge.svg)](https://codecov.io/gh/fent/node-ytdl-core) | ||
@@ -30,3 +30,3 @@ | ||
* `format` - This can be a specific `format` object returned from `getInfo`. This is primarily used to download specific video or audio streams. **Note:** Supplying this option will ignore the `filter` and `quality` options since the format is explicitly provided. | ||
* `range` - A byte range in the form `INT-INT` that specifies a part of the video to download. ie 10355705-12452856. | ||
* `range` - A byte range in the form `INT-INT` that specifies part of the file to download. ie 10355705-12452856. Note that this downloads a portion of the file, and not a separately spliced video. | ||
* `requestOptions` - Anything to merge into the request options which `http.get()` is called with, such as headers. | ||
@@ -58,5 +58,5 @@ * `request` - A function that will be called for each request, instead of ytdl's internal method of making requests. Its signature looks like `Function(url, options, [callback(error, body)]): http.ClientRequest` | ||
### ytdl.getInfo(url, [options], callback(err, info)) | ||
### ytdl.getInfo(url, [options], [callback(err, info)]) | ||
Use this if you only want to get metainfo from a video. | ||
Use this if you only want to get metainfo from a video. If `callback` isn't given, returns a promise. | ||
@@ -76,9 +76,15 @@ ### ytdl.downloadFromInfo(info, options) | ||
# Tips | ||
### Handling Separate Streams | ||
## Limitations | ||
Typically 1080p or better video does not have audio encoded with it. The audio must be downloaded separately and merged via an appropriate encoding library. `ffmpeg` is the most widely used tool, with many [Node.js modules available](https://www.npmjs.com/search?q=ffmpeg). Use the `format` objects returned from `ytdl.getInfo` to download specific streams to combine to fit your needs. | ||
ytdl cannot download videos that fall into the following | ||
* Regionally restricted (requires a [proxy](example/proxy.js)) | ||
* Private | ||
* Rentals | ||
### What if it stops working? | ||
## Handling Separate Streams | ||
Typically 1080p or better video does not have audio encoded with it. The audio must be downloaded separately and merged via an appropriate encoding library. `ffmpeg` is the most widely used tool, with many [Node.js modules available](https://www.npmjs.com/search?q=ffmpeg). Use the `format` objects returned from `ytdl.getInfo` to download specific streams to combine to fit your needs. Look at [example/ffmpeg.js](example/ffmpeg.js) for an example on doing this. | ||
## What if it stops working? | ||
Youtube updates their website all the time, it's not that rare for this to stop working. If it doesn't work for you and you're using the latest version, feel free to open up an issue. Make sure to check if there isn't one already with the same error. | ||
@@ -98,3 +104,3 @@ | ||
And for the specifics on that, you can look at the `extractActions()` function in [`/lib/sig.js`](https://github.com/fent/node-ytdl-core/blob/master/lib/sig.js). | ||
For the specifics on that, you can look at the `extractActions()` function in [`/lib/sig.js`](https://github.com/fent/node-ytdl-core/blob/master/lib/sig.js). | ||
@@ -101,0 +107,0 @@ |
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
118
1
50740
12
1643