Skip to content

Commit

Permalink
[sankaku] update pagination end condition (fixes #265)
Browse files Browse the repository at this point in the history
Pagination over popular listings (`date:...+order:popular") never
terminates, not even on the site itself, and at some point returns the
same results over and over again.
  • Loading branch information
mikf committed May 20, 2019
1 parent d514d49 commit efa805c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## Unreleased

## 1.8.4 - 2019-05-17
### Additions
- Support for
Expand Down
5 changes: 5 additions & 0 deletions gallery_dl/extractor/sankaku.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ def get_posts(self):

next_qs = text.extract(page, 'next-page-url="/?', '"', pos)[0]
next_id = text.parse_query(next_qs).get("next")

# stop if the same "next" parameter occurs twice in a row (#265)
if "next" in params and params["next"] == next_id:
return

params["next"] = next_id or (text.parse_int(ids[-1]) - 1)
params["page"] = "2"

Expand Down
2 changes: 1 addition & 1 deletion gallery_dl/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.

__version__ = "1.8.4"
__version__ = "1.8.5-dev"

0 comments on commit efa805c

Please sign in to comment.