summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/weibo.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-12-25 19:40:28 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-12-25 19:40:28 -0500
commitf9a1a9dcb7df977eeac9544786df9c0b93795815 (patch)
tree8cb69cf7685da8d7e4deb7dc1d6b209098e1ddfb /gallery_dl/extractor/weibo.py
parent0c73e982fa596da07f23b377621ab894a9e64884 (diff)
New upstream version 1.12.1upstream/1.12.1
Diffstat (limited to 'gallery_dl/extractor/weibo.py')
-rw-r--r--gallery_dl/extractor/weibo.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/gallery_dl/extractor/weibo.py b/gallery_dl/extractor/weibo.py
index 0f4ebd2..49fa082 100644
--- a/gallery_dl/extractor/weibo.py
+++ b/gallery_dl/extractor/weibo.py
@@ -9,7 +9,7 @@
"""Extractors for https://www.weibo.com/"""
from .common import Extractor, Message
-from .. import text
+from .. import text, exception
import json
@@ -124,7 +124,7 @@ class WeiboStatusExtractor(WeiboExtractor):
}),
# unavailable video (#427)
("https://m.weibo.cn/status/4268682979207023", {
- "count": 0,
+ "exception": exception.NotFoundError,
}),
("https://m.weibo.cn/status/4339748116375525"),
("https://m.weibo.cn/5746766133/4339748116375525"),
@@ -136,7 +136,8 @@ class WeiboStatusExtractor(WeiboExtractor):
def statuses(self):
url = "{}/detail/{}".format(self.root, self.status_id)
- page = self.request(url).text
- data = json.loads(text.extract(
- page, " var $render_data = [", "][0] || {};")[0])
- return (data["status"],)
+ page = self.request(url, notfound="status").text
+ data = text.extract(page, "var $render_data = [", "][0] || {};")[0]
+ if not data:
+ raise exception.NotFoundError("status")
+ return (json.loads(data)["status"],)