ytsearcher
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -13,3 +13,3 @@ 'use strict'; | ||
const querystring = require('querystring'); | ||
const { get } = require('snekfetch'); | ||
const { get } = require('https'); | ||
const Constants = require('../deps/Constants'); | ||
@@ -90,5 +90,20 @@ const { YTSearchPage } = require('./YTSearchPage'); | ||
const queryUrl = `${apiurl}${querystring.stringify(searchParams)}`; | ||
const promise = new Promise((_res, _rej) => get(queryUrl, response => { | ||
if (response.statusCode !== 200) { | ||
response.resume(); | ||
return _rej(new Error(`Error code: ${response.statusCode}`)); | ||
} | ||
let chunks = []; | ||
response.on('data', chunk => chunks.push(chunk)); | ||
return response.on('end', () => { | ||
try { | ||
const buf = Buffer.concat(chunks); | ||
return _res({ body: JSON.parse(buf) }); | ||
} catch (err) { | ||
return _rej(err); | ||
} | ||
}); | ||
})); | ||
get(queryUrl).then(response => { | ||
if (response.statusCode !== 200) return rej(new Error(`Error code: ${response.statusCode}`)); | ||
promise.then(response => { | ||
const body = response.body; | ||
@@ -95,0 +110,0 @@ if (body.error) return rej(new Error(body.error.message)); |
{ | ||
"name": "ytsearcher", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "A nodejs package that provides an easy-to-use promise-based system of getting youtube search results", | ||
@@ -19,7 +19,9 @@ "main": "index.js", | ||
"keywords": [ | ||
"Promise-Based", | ||
"YouTube", | ||
"Searcher", | ||
"ytsearcher", | ||
"Pagination" | ||
"Pagination", | ||
"Promise", | ||
"modern", | ||
"es6" | ||
], | ||
@@ -32,6 +34,3 @@ "author": "William Zhou", | ||
"homepage": "https://wzhouwzhou.github.io/ytsearcher/", | ||
"dependencies": { | ||
"querystring": "^0.2.0", | ||
"snekfetch": "^4.0.2" | ||
} | ||
"dependencies": {} | ||
} |
@@ -8,2 +8,3 @@ <div align="center"> | ||
<a href="https://david-dm.org/wzhouwzhou/ytsearcher"><img src="https://img.shields.io/david/wzhouwzhou/ytsearcher.svg" alt="Dependencies" /></a> | ||
<a href="https://snyk.io/test/npm/ytsearcher"><img src="https://snyk.io/test/npm/ytsearcher/badge.svg" alt="Known Vulnerabilities" data-canonical-src="https://snyk.io/test/npm/ytsearcher" style="max-width:100%;"></a> | ||
<a href="https://paypal.me/wzhouwzhou"><img src="https://img.shields.io/badge/donate-paypal-009cde.svg" alt="Paypal" /></a> | ||
@@ -21,5 +22,12 @@ </p> | ||
```$ npm install ytsearcher``` | ||
```$ npm install ytsearcher@1.2.0``` | ||
### Quick Start Guide | ||
### Why ytsearcher? | ||
• Modern and trustworthy (promises, es6, up-to-date) with thousands of downloads. | ||
• Lightweight (packed size < 10kB) and NO other dependencies; this means **more productivity, less bloat**! | ||
### I'm all about that! How do I start searching YouTube the right way? | ||
**Creating the object:** | ||
@@ -138,1 +146,7 @@ | ||
Full docs are available here: [http://ytsearcher.willyz.cf](https://ytsearcher.willyz.cf) | ||
Enjoy this package? Consider starring on [github](https://github.com/wzhouwzhou/ytsearcher) and checking out some of my other work: | ||
[Fluent Filepaths](https://npmjs.com/easypathutil) | ||
[Urban Dictionary](https://npmjs.com/easyurban) |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
Network access
Supply chain riskThis module accesses the network.
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 10 instances in 1 package
0
150
2
29933
9
360
- Removedquerystring@^0.2.0
- Removedsnekfetch@^4.0.2
- Removedquerystring@0.2.1(transitive)
- Removedsnekfetch@4.0.4(transitive)