summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/weibo.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-04-29 01:58:56 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-04-29 01:58:56 -0400
commitc6b88a96bd191711fc540d7babab3d2e09c68da8 (patch)
tree288f3641ea19865740191b452da8832021772b8c /gallery_dl/extractor/weibo.py
parent2fe1dfed848fc26b7419e3bfe91a62e686960429 (diff)
New upstream version 1.21.2.upstream/1.21.2
Diffstat (limited to 'gallery_dl/extractor/weibo.py')
-rw-r--r--gallery_dl/extractor/weibo.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/gallery_dl/extractor/weibo.py b/gallery_dl/extractor/weibo.py
index 81ca87f..1929f98 100644
--- a/gallery_dl/extractor/weibo.py
+++ b/gallery_dl/extractor/weibo.py
@@ -105,6 +105,10 @@ class WeiboUserExtractor(WeiboExtractor):
("https://m.weibo.cn/u/2314621010", {
"range": "1-30",
}),
+ # deleted (#2521)
+ ("https://weibo.com/u/7500315942", {
+ "count": 0,
+ }),
("https://m.weibo.cn/profile/2314621010"),
("https://m.weibo.cn/p/2304132314621010_-_WEIBO_SECOND_PROFILE_WEIBO"),
("https://www.weibo.com/p/1003062314621010/home"),
@@ -132,14 +136,24 @@ class WeiboUserExtractor(WeiboExtractor):
while True:
response = self.request(url, params=params, headers=headers)
headers["X-XSRF-TOKEN"] = response.cookies.get("XSRF-TOKEN")
- data = response.json()["data"]
+ data = response.json()
+ if not data.get("ok"):
+ self.log.debug(response.content)
+ if "since_id" not in params: # first iteration
+ raise exception.StopExtraction(
+ '"%s"', data.get("msg") or "unknown error")
+
+ data = data["data"]
for card in data["cards"]:
if "mblog" in card:
yield card["mblog"]
info = data.get("cardlistInfo")
if not info:
+ # occasionally weibo returns an empty response
+ # repeating the same request usually/eventually yields
+ # the correct response.
continue
params["since_id"] = sid = info.get("since_id")