Use 'id:<POSTID' as a tag instead of going through pages with 'pid'. Something similar was already implemented in93cef784, but that got broken again in3085aac4.
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
## 1.20.3 - 2022-01-26
|
## 1.20.3 - 2022-01-26
|
||||||
### Fixes
|
### Fixes
|
||||||
- [kemonoparty] fix DMs extraction ([#2008](https://github.com/mikf/gallery-dl/issues/2008))
|
- [kemonoparty] fix DMs extraction ([#2008](https://github.com/mikf/gallery-dl/issues/2008))
|
||||||
- [twitter] fix crash ob Tweets with deleted quotes ([#2225](https://github.com/mikf/gallery-dl/issues/2225))
|
- [twitter] fix crash on Tweets with deleted quotes ([#2225](https://github.com/mikf/gallery-dl/issues/2225))
|
||||||
- [twitter] fix crash on suspended Tweets without `legacy` entry ([#2216](https://github.com/mikf/gallery-dl/issues/2216))
|
- [twitter] fix crash on suspended Tweets without `legacy` entry ([#2216](https://github.com/mikf/gallery-dl/issues/2216))
|
||||||
- [twitter] fix crash on unified cards without `type`
|
- [twitter] fix crash on unified cards without `type`
|
||||||
- [twitter] prevent crash on invalid/deleted Retweets ([#2225](https://github.com/mikf/gallery-dl/issues/2225))
|
- [twitter] prevent crash on invalid/deleted Retweets ([#2225](https://github.com/mikf/gallery-dl/issues/2225))
|
||||||
|
|||||||
@@ -33,28 +33,20 @@ class GelbooruBase():
|
|||||||
def _pagination(self, params):
|
def _pagination(self, params):
|
||||||
params["pid"] = self.page_start
|
params["pid"] = self.page_start
|
||||||
params["limit"] = self.per_page
|
params["limit"] = self.per_page
|
||||||
|
limit = self.per_page // 2
|
||||||
|
|
||||||
post = None
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
posts = self._api_request(params)
|
||||||
posts = self._api_request(params)
|
|
||||||
except ValueError:
|
|
||||||
if "tags" not in params or post is None:
|
|
||||||
raise
|
|
||||||
taglist = [tag for tag in params["tags"].split()
|
|
||||||
if not tag.startswith("id:<")]
|
|
||||||
taglist.append("id:<" + str(post.attrib["id"]))
|
|
||||||
params["tags"] = " ".join(taglist)
|
|
||||||
params["pid"] = 0
|
|
||||||
continue
|
|
||||||
|
|
||||||
post = None
|
|
||||||
for post in posts:
|
for post in posts:
|
||||||
yield post
|
yield post
|
||||||
|
|
||||||
if len(posts) < self.per_page:
|
if len(posts) < limit:
|
||||||
return
|
return
|
||||||
params["pid"] += 1
|
|
||||||
|
if "pid" in params:
|
||||||
|
del params["pid"]
|
||||||
|
params["tags"] = "{} id:<{}".format(self.tags, post["id"])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _file_url(post):
|
def _file_url(post):
|
||||||
@@ -81,9 +73,12 @@ class GelbooruTagExtractor(GelbooruBase,
|
|||||||
("https://gelbooru.com/index.php?page=post&s=list&tags=bonocho", {
|
("https://gelbooru.com/index.php?page=post&s=list&tags=bonocho", {
|
||||||
"count": 5,
|
"count": 5,
|
||||||
}),
|
}),
|
||||||
("https://gelbooru.com/index.php?page=post&s=list&tags=bonocho", {
|
("https://gelbooru.com/index.php?page=post&s=list&tags=meiya_neon", {
|
||||||
"options": (("api", False),),
|
"range": "196-204",
|
||||||
"count": 5,
|
"url": "845a61aa1f90fb4ced841e8b7e62098be2e967bf",
|
||||||
|
"pattern": r"https://img\d\.gelbooru\.com"
|
||||||
|
r"/images/../../[0-9a-f]{32}\.jpg",
|
||||||
|
"count": 9,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -6,4 +6,4 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
__version__ = "1.20.3"
|
__version__ = "1.20.4-dev"
|
||||||
|
|||||||
Reference in New Issue
Block a user