better-youtube-api
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -163,3 +163,3 @@ "use strict"; | ||
default: | ||
throw new Error('Type must be a video, channel, or playlist'); | ||
return Promise.reject('Type must be a video, channel, or playlist'); | ||
} | ||
@@ -214,3 +214,3 @@ }); | ||
default: | ||
throw new Error('Type must be a video, channel, or playlist'); | ||
return Promise.reject('Type must be a video, channel, or playlist'); | ||
} | ||
@@ -240,3 +240,3 @@ }); | ||
if (maxResults > max) { | ||
return Promise.reject(`Max results must be ${max} or below`); | ||
return Promise.reject(`Max results must be ${max} or below for ${type}`); | ||
} | ||
@@ -326,3 +326,4 @@ const options = { | ||
exports.YouTube = YouTube; | ||
exports.default = YouTube; | ||
//# sourceMappingURL=index.js.map |
@@ -22,19 +22,7 @@ "use strict"; | ||
const options = parseUrlToOptions(url, 'POST'); | ||
return req(options, req => { | ||
req.on('error', error => { | ||
throw error; | ||
}); | ||
req.write(data); | ||
req.end(); | ||
}); | ||
return req(options, req => reqCallback(req, data)); | ||
} | ||
function put(url, data) { | ||
const options = parseUrlToOptions(url, 'PUT'); | ||
return req(options, req => { | ||
req.on('error', error => { | ||
throw error; | ||
}); | ||
req.write(data); | ||
req.end(); | ||
}); | ||
return req(options, req => reqCallback(req, data)); | ||
} | ||
@@ -66,6 +54,6 @@ function parseUrlToOptions(url, type) { | ||
} | ||
resolve(parsed); | ||
return resolve(parsed); | ||
}); | ||
res.on('error', error => { | ||
reject(error); | ||
return reject(error); | ||
}); | ||
@@ -76,2 +64,10 @@ }; | ||
} | ||
function reqCallback(req, data) { | ||
req.on('error', error => { | ||
throw error; | ||
}); | ||
if (data) | ||
req.write(data); | ||
req.end(); | ||
} | ||
function parseParams(params) { | ||
@@ -78,0 +74,0 @@ let url = ''; |
{ | ||
"name": "better-youtube-api", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"description": "A very easy to use promise-based Youtube Data v3 API.", | ||
@@ -9,2 +9,3 @@ "main": "out/index.js", | ||
"test": "mocha -r ts-node/register ./**/*.spec.ts", | ||
"docs": "gulp typedoc", | ||
"prepublishOnly": "gulp" | ||
@@ -31,2 +32,3 @@ }, | ||
"gulp-sourcemaps": "^2.6.4", | ||
"gulp-typedoc": "^2.2.0", | ||
"gulp-typescript": "^5.0.0-alpha.3", | ||
@@ -38,2 +40,3 @@ "merge2": "^1.2.3", | ||
"tslint-config-standard": "^7.1.0", | ||
"typedoc": "^0.13.0", | ||
"typescript": "^3.0.1" | ||
@@ -40,0 +43,0 @@ }, |
@@ -5,3 +5,3 @@ # Better YouTube API | ||
# Examples | ||
First of all, I recommend that you check out `out/index.d.ts` for all of the methods and what they return. Here are some basic methods: | ||
First of all, I recommend that you check out [the documentation](https://jasonhaxstuff.github.io/better-youtube-api/) for all of the methods and what they return. Here are some basic methods: | ||
@@ -8,0 +8,0 @@ Instantiate the object: |
import { YouTube } from '..'; | ||
import { Thumbnail } from '../types'; | ||
import { Thumbnail, ISODuration } from '../types'; | ||
import { YTComment } from './Comment'; | ||
@@ -50,3 +50,3 @@ /** | ||
channelId: string; | ||
private _length; | ||
_length: ISODuration; | ||
/** | ||
@@ -53,0 +53,0 @@ * The minutes of the video. |
@@ -90,2 +90,3 @@ import { Video, Channel, Playlist, YTComment } from './entities'; | ||
} | ||
export default YouTube; | ||
//# sourceMappingURL=index.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
204708
1
16
1222