jmcomic 2.7.7__tar.gz → 2.7.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {jmcomic-2.7.7/src/jmcomic.egg-info → jmcomic-2.7.8}/PKG-INFO +1 -1
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/__init__.py +1 -1
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_async_client.py +8 -10
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_client_impl.py +8 -14
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_toolkit.py +1 -1
- {jmcomic-2.7.7 → jmcomic-2.7.8/src/jmcomic.egg-info}/PKG-INFO +1 -1
- {jmcomic-2.7.7 → jmcomic-2.7.8}/LICENSE +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/README.md +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/pyproject.toml +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/setup.cfg +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/setup.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/api.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/cli.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_async_downloader.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_client_interface.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_config.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_downloader.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_entity.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_exception.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_feature.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_option.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_plugin.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic/jm_task_context.py +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic.egg-info/SOURCES.txt +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic.egg-info/dependency_links.txt +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic.egg-info/entry_points.txt +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic.egg-info/requires.txt +0 -0
- {jmcomic-2.7.7 → jmcomic-2.7.8}/src/jmcomic.egg-info/top_level.txt +0 -0
|
@@ -337,16 +337,14 @@ class AsyncJmApiClient(AsyncJmcomicClient):
|
|
|
337
337
|
# /chapter_view_template 这个接口不是返回json数据,不做检查
|
|
338
338
|
return
|
|
339
339
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return
|
|
349
|
-
ExceptionTool.raises_resp(f'响应无数据!', resp)
|
|
340
|
+
try:
|
|
341
|
+
JmcomicText.try_parse_json_object(getattr(resp, 'text', ''))
|
|
342
|
+
except Exception:
|
|
343
|
+
text = getattr(resp, 'text', '')
|
|
344
|
+
ExceptionTool.raises_resp(
|
|
345
|
+
f'请求不是json格式,强制重试!响应文本: [{JmcomicText.limit_text(text, 200)}]',
|
|
346
|
+
resp,
|
|
347
|
+
)
|
|
350
348
|
|
|
351
349
|
@staticmethod
|
|
352
350
|
def _require_resp_success(resp: JmApiResp):
|
|
@@ -1244,9 +1244,6 @@ class JmApiClient(AbstractJmClient):
|
|
|
1244
1244
|
"""
|
|
1245
1245
|
该方法会判断resp返回值是否是json格式,
|
|
1246
1246
|
如果不是,大概率是禁漫内部异常,需要进行重试
|
|
1247
|
-
|
|
1248
|
-
由于完整的json格式校验会有性能开销,所以只做简单的检查,
|
|
1249
|
-
只校验第一个有效字符是不是 '{',如果不是,就认为异常数据,需要重试
|
|
1250
1247
|
"""
|
|
1251
1248
|
resp = super().raise_if_resp_should_retry(resp, is_image)
|
|
1252
1249
|
|
|
@@ -1266,17 +1263,14 @@ class JmApiClient(AbstractJmClient):
|
|
|
1266
1263
|
# /chapter_view_template 这个接口不是返回json数据,不做检查
|
|
1267
1264
|
return resp
|
|
1268
1265
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
return resp
|
|
1278
|
-
|
|
1279
|
-
ExceptionTool.raises_resp(f'响应无数据!request_url=[{url}]', resp)
|
|
1266
|
+
try:
|
|
1267
|
+
JmcomicText.try_parse_json_object(resp.text)
|
|
1268
|
+
return resp
|
|
1269
|
+
except Exception:
|
|
1270
|
+
ExceptionTool.raises_resp(
|
|
1271
|
+
f'请求不是json格式,强制重试!响应文本: [{JmcomicText.limit_text(resp.text, 200)}]',
|
|
1272
|
+
resp,
|
|
1273
|
+
)
|
|
1280
1274
|
|
|
1281
1275
|
def after_init(self):
|
|
1282
1276
|
# 自动更新禁漫API域名
|
|
@@ -408,7 +408,7 @@ class JmcomicText:
|
|
|
408
408
|
@classmethod
|
|
409
409
|
def try_parse_json_object(cls, resp_text: str) -> dict:
|
|
410
410
|
import json
|
|
411
|
-
text = resp_text.strip()
|
|
411
|
+
text = resp_text.strip().lstrip('\ufeff')
|
|
412
412
|
if text.startswith('{') and text.endswith('}'):
|
|
413
413
|
# fast case
|
|
414
414
|
return json.loads(text)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|