Skip to content

Commit 85b7c98

Browse files
authored
#569 _requestAllPages parse options
#569 _requestAllPages parse options.page from nextUrl
1 parent bf3a408 commit 85b7c98

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/Requestable.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,17 @@ class Requestable {
256256
results.push(...thisGroup);
257257

258258
const nextUrl = getNextPage(response.headers.link);
259-
if (nextUrl && !(options && typeof options.page !== 'number')) {
260-
log(`getting next page: ${nextUrl}`);
261-
return this._requestAllPages(nextUrl, options, cb, results);
259+
if(nextUrl) {
260+
options.page = parseInt(
261+
nextUrl.match(/(&page=[0-9]*)/g)
262+
.shift()
263+
.split('=')
264+
.pop()
265+
);
266+
if (!(options && typeof options.page !== 'number')) {
267+
log('getting next page: ' + nextUrl);
268+
return _this2._requestAllPages(nextUrl, options, cb, results);
269+
}
262270
}
263271

264272
if (cb) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy