Comparing version 3.5.0 to 3.5.1
@@ -120,2 +120,3 @@ const PARSE_ITEM = require('./parseItem.js'); | ||
main.continueReq = async args => { | ||
// Check params | ||
if (!Array.isArray(args) || args.length !== 4) throw new Error('invalid continuation array'); | ||
@@ -126,3 +127,6 @@ if (!args[0] || typeof args[0] !== 'string') throw new Error('invalid apiKey'); | ||
if (!args[3] || typeof args[3] !== 'object') throw new Error('invalid opts'); | ||
if (!isNaN(args[3].limit) && isFinite(args[3].limit)) throw new Error('continueReq only allowed for paged requests'); | ||
if (args[3].limit !== null && !isNaN(args[3].limit) && isFinite(args[3].limit)) { | ||
throw new Error('continueReq only allowed for paged requests'); | ||
} | ||
// Enforce pagination information | ||
args[3].pages = 1; | ||
@@ -129,0 +133,0 @@ args[3].limit = Infinity; |
@@ -93,3 +93,3 @@ const UTIL = require('./utils.js'); | ||
info += `node.js: ${process.version}, `; | ||
info += `ytpl: ${require('../package.json').version}`; | ||
info += `ytsr: ${require('../package.json').version}`; | ||
console.error(info); | ||
@@ -96,0 +96,0 @@ console.error(`${'*'.repeat(200)}\\`); |
@@ -0,0 +0,0 @@ const MINIGET = require('miniget'); |
{ | ||
"name": "ytsr", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "Simple package to search YouTube - no strings attached.", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
"dependencies": { | ||
"miniget": "^4.2.0" | ||
"miniget": "^4.2.1" | ||
}, | ||
@@ -50,0 +50,0 @@ "devDependencies": { |
@@ -20,3 +20,2 @@ # node-ytsr | ||
const searchResults = await ytsr('github'); | ||
dosth(searchResults); | ||
``` | ||
@@ -63,3 +62,2 @@ | ||
const searchResults = await ytsr(filter2.url, options); | ||
dosth(searchResults); | ||
``` | ||
@@ -83,10 +81,12 @@ | ||
```js | ||
var ytsr = require('ytsr'); | ||
const ytsr = require('ytsr'); | ||
const search = await ytsr('github', { pages: 1 }); | ||
display(search.items); | ||
const r2 = ytsr.continueReq(search.continuation); | ||
display(r2.items); | ||
const r3 = ytsr.continueReq(r2.continuation); | ||
display(r3.items); | ||
const firstResultBatch = await ytsr('github', { pages: 1 }); | ||
const secondResultBatch = ytsr.continueReq(firstResultBatch.continuation); | ||
const thirdResultBatch = ytsr.continueReq(secondResultBatch.continuation); | ||
// You can now use the .items property of all result batches e.g.: | ||
console.log(firstResultBatch.items); | ||
console.log(secondResultBatch.items); | ||
console.log(thirdResultBatch.items); | ||
``` | ||
@@ -93,0 +93,0 @@ |
@@ -0,0 +0,0 @@ declare module 'ytsr' { |
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
975
43831
Updatedminiget@^4.2.1