Skip to content

Commit 96893e0

Browse files
authored
Merge-build: v2.5.1
2 parents 2d4323f + 1cee298 commit 96893e0

File tree

9 files changed

+41
-45
lines changed

9 files changed

+41
-45
lines changed

ComicSpider/spiders/kaobei.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ def byQingXiaoShuo(self):
4949
class KaobeiSpider(BaseComicSpider):
5050
name = 'manga_copy'
5151
ua = headers = {
52-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36 Edg/139.0.0.0',
52+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0',
5353
'Accept': '*/*',
54-
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6,ja;q=0.5',
54+
'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
5555
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
56+
'dnts': '2',
5657
'Connection': 'keep-alive',
57-
'dnts': '1',
58+
'Sec-Fetch-Dest': 'empty',
59+
'Sec-Fetch-Mode': 'cors',
60+
'Sec-Fetch-Site': 'same-origin',
61+
'Pragma': 'no-cache',
62+
'Cache-Control': 'no-cache',
5863
}
5964
ua_mapi = {
6065
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1',
@@ -139,7 +144,7 @@ def frame_section(self, response):
139144
frame_results = {}
140145
say_ep_fm = ' -{}、【{}】'
141146
self.say(say_ep_fm.format('序号', '章节') + '<br>')
142-
resp_data = KaobeiUtils.decrypt_chapter_data(response.json()['results'])
147+
resp_data = KaobeiUtils.decrypt_chapter_data(response.json()['results'], url=response.url)
143148
comic_path_word = resp_data['build']['path_word']
144149
chapters_data = resp_data['groups']['default']['chapters']
145150
if conf.kbShowDhb:
@@ -170,7 +175,7 @@ def parse_fin_page(self, response):
170175
if not contentKey_script:
171176
raise ValueError("拷贝更改了contentKey xpath")
172177
contentKey = re.search(r"""var contentKey = ["']([^']*)["']""", contentKey_script).group(1)
173-
imageData = KaobeiUtils.decrypt_chapter_data(contentKey)
178+
imageData = KaobeiUtils.decrypt_chapter_data(contentKey, url=response.url, group_infos=group_infos)
174179
ep.pages = len(imageData)
175180
self.set_task(ep)
176181
for page, url_item in enumerate(imageData):

GUI/manager/async_task.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def __init__(self,
8282
class AsyncTaskManager(QObject):
8383
"""异步任务管理器 - 流程化耗时操作处理"""
8484

85-
def __init__(self, parent_widget=None):
85+
def __init__(self, gui=None):
8686
super().__init__()
87-
self.parent_widget = parent_widget
87+
self.gui = gui
8888
self.current_tasks: Dict[str, AsyncTaskThread] = {}
8989
self.current_tooltips: Dict[str, StateToolTip] = {}
9090
self._tooltip_offset_counter = 0 # 用于计算tooltip位置偏移
@@ -250,7 +250,7 @@ def _show_tooltip(self, task_id: str, title: str, content: str,
250250
position: Optional[tuple] = None, parent: Optional[QObject] = None):
251251
"""显示状态提示"""
252252
# 确定父组件
253-
tooltip_parent = parent or self.parent_widget
253+
tooltip_parent = parent or self.gui
254254
if not tooltip_parent:
255255
return
256256
tooltip = StateToolTip(title, content, tooltip_parent)
@@ -291,13 +291,13 @@ def _cleanup_tooltip(self, task_id: str):
291291

292292
def _rearrange_tooltips(self):
293293
"""重新排列剩余tooltip的位置,避免空隙"""
294-
if not self.current_tooltips or not self.parent_widget:
294+
if not self.current_tooltips or not self.gui:
295295
self._tooltip_offset_counter = 0
296296
return
297297

298298
# 按创建顺序重新排列tooltip位置
299299
for i, tooltip in enumerate(self.current_tooltips.values()):
300-
x = self.parent_widget.width() - tooltip.width() - 30
300+
x = self.gui.width() - tooltip.width() - 30
301301
y = 20 + (i * 80) # 每个tooltip垂直间隔80像素
302302
tooltip.move(x, y)
303303

@@ -314,30 +314,31 @@ def _show_success(self, message: str):
314314
...
315315

316316
def _show_error(self, message: str):
317-
if self.parent_widget:
317+
if self.gui:
318318
InfoBar.error(
319319
title='错误', content=message,
320320
orient=Qt.Horizontal, isClosable=True,
321321
position=InfoBarPosition.TOP,
322-
duration=-1, parent=self.parent_widget
322+
duration=-1, parent=self.gui
323323
)
324+
self.gui.log.error(message)
324325

325326
def _show_warning(self, message: str):
326-
if self.parent_widget:
327+
if self.gui:
327328
InfoBar.warning(
328329
title='警告', content=message,
329330
orient=Qt.Horizontal, isClosable=True,
330331
position=InfoBarPosition.TOP,
331-
duration=6000, parent=self.parent_widget
332+
duration=6000, parent=self.gui
332333
)
333334

334335
def _show_info(self, message: str):
335-
if self.parent_widget:
336+
if self.gui:
336337
InfoBar.info(
337338
title='', content=message,
338339
orient=Qt.Horizontal, isClosable=True,
339340
position=InfoBarPosition.TOP,
340-
duration=2000, parent=self.parent_widget
341+
duration=2000, parent=self.gui
341342
)
342343

343344
def cleanup(self):

GUI/manager/preprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def _preprocess_hitomi(self):
144144
def hitomi_check():
145145
self.gui.spiderUtils = self.gui.spiderUtils(conf)
146146
if not self.gui.spiderUtils.test_index():
147-
raise RuntimeError(f"access_fail:{self.gui.spiderUtils.name}:{self.gui.spiderUtils.index}")
147+
raise RuntimeError(f"test-nozomi fail:{self.gui.spiderUtils.name}: {self.gui.spiderUtils.test_nozomi}")
148148
return True
149149

150150
def on_error(_):
@@ -321,7 +321,7 @@ def download_kemono_data():
321321
author_dict[author_id] = author
322322
return author_dict
323323
except Exception as e:
324-
raise RuntimeError(f"数据下载失败: {str(e)}")
324+
raise RuntimeError(f"数据下载失败: ...{str(e)[:-300]}")
325325
data = download_kemono_data()
326326
return True
327327

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727

2828
## 📑介绍
2929

30-
C106了, 用 CGS 框框地下下下吧 🍻,顺便求⭐️
30+
⚠️重要通知,点star⭐️限时免费‼️👉 [![stars](https://img.shields.io/github/stars/jasoneri/ComicGUISpider
31+
)](https://github.com/jasoneri/ComicGUISpider/stargazers)
32+
☝️😆👎💩
3133

3234
| 网站 | 适用区域 | 补充说明 | 状态<br>(UTC+8) |
3335
|:--------------------------------------|:----:|:----------:|:----:|
@@ -43,10 +45,7 @@ C106了, 用 CGS 框框地下下下吧 🍻,顺便求⭐️
4345

4446
---
4547

46-
**[![stars](https://img.shields.io/github/stars/jasoneri/ComicGUISpider
47-
)](https://github.com/jasoneri/ComicGUISpider/stargazers)&nbsp;&nbsp;
48-
个人开发精力有限,
49-
提问反馈前请参考 [🔗提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
48+
**🔉个人开发精力有限,提问反馈前请参考 [🔗提问的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
5049
),至起码阅读过 [不该问的问题](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md#%E4%B8%8D%E8%AF%A5%E9%97%AE%E7%9A%84%E9%97%AE%E9%A2%98
5150
) 和 [好问题与蠢问题](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md#%E5%A5%BD%E9%97%AE%E9%A2%98%E4%B8%8E%E8%A0%A2%E9%97%AE%E9%A2%98)**
5251

@@ -58,30 +57,16 @@ C106了, 用 CGS 框框地下下下吧 🍻,顺便求⭐️
5857

5958
#### 🎁 Features
6059

61-
✅ 优化线程进程相关实例再利用,显著提升内置重启
62-
🚧 重构数据格式以支持后续筛选过滤功能
63-
64-
#### 🐞 Fix
65-
66-
✖️ jm 域名策略变化的关系,暂时关闭jm的读剪贴板/章节功能,等 [cloudscraper](https://github.com/VeNoMouS/cloudscraper/issues/285) 支持异步或找到解决方案后恢复..
67-
✅ 修复内置更新稳定性
68-
✅ 修复 jm 列表含5位数车号以下时报错
69-
70-
<details>
71-
<summary> <code>🧪v2.5.1-beta.3</code> 开发版特性👈看就点</summary>
72-
73-
#### 🎁 Features
74-
7560
✅✨ bootstrap 升至5.3, 预览窗口跟随 CGS 主题色(夜间模式)
7661

7762
#### 🐞 Fix
7863

7964
✅ 恢复 jm 的读剪贴板/章节功能
8065
✅ 修复优化 读剪贴板-章节 过多时的选择显示等问题
66+
✅ 修复拷贝(可能),hitomi 等网络杂项
67+
✅ 各种预处理时报错时也记录进 GUI.log 里了
8168
✅ 解决域名缓存不变时恶性循环获取
8269

83-
</details>
84-
8570
> 可参考 [更新方法](https://jasoneri.github.io//ComicGUISpider/deploy/quick-start.html#_4-%E6%9B%B4%E6%96%B0) 进行更新
8671
8772
> [🕑更新历史](docs/changelog/history.md) / [📝开发板](https://github.com/jasoneri/ComicGUISpider/projects?query=is%3Aopen)

docs/_github/release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77

88
✅ 恢复 jm 的读剪贴板/章节功能
99
✅ 修复优化 读剪贴板-章节 过多时的选择显示等问题
10+
✅ 修复拷贝(可能),hitomi 等网络杂项
11+
✅ 各种预处理时报错时也记录进 GUI.log 里了
1012
✅ 解决域名缓存不变时恶性循环获取

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "ComicGUISpider"
3-
version = "2.5.1-beta.3"
3+
version = "2.5.1"
44
description = "GUI Comic Downloader"
55
readme = "README.md"
66
requires-python = ">=3.12"

utils/website/hitomi/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ class HitomiUtils(EroUtils, Req):
1515
index = "https://hitomi.la/"
1616
domain = r"ltn.gold-usergeneratedcontent.net"
1717
domain2 = r"gold-usergeneratedcontent.net"
18+
test_nozomi = f'https://{domain}/popular/week-all.nozomi'
1819
headers = {
1920
"accept": "*/*",
2021
"accept-language": res.Vars.ua_accept_language,
21-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:137.0) Gecko/20100101 Firefox/137.0",
22+
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0",
2223
"referer": index
2324
}
2425
book_hea = headers
@@ -87,7 +88,7 @@ def get_cli(cls, conf, is_async=False, **kwargs):
8788

8889
def test_index(self):
8990
try:
90-
resp = self.cli.head(f'https://{self.domain}/popular/week-all.nozomi',
91+
resp = self.cli.head(self.test_nozomi,
9192
headers={**HitomiUtils.headers, "Range": self.get_range(1)},
9293
follow_redirects=True, timeout=3.5)
9394
resp.raise_for_status()

utils/website/ins.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class KaobeiUtils(Utils):
340340

341341
@classmethod
342342
@cachef.with_error_cleanup()
343-
def decrypt_chapter_data(cls, ret: str):
343+
def decrypt_chapter_data(cls, ret: str, **meta_info):
344344
def _(cipher_hex: str, key: str, iv: str) -> dict:
345345
cipher_bytes = bytes.fromhex(cipher_hex)
346346
key_bytes = key.encode('utf-8')
@@ -355,6 +355,8 @@ def _(cipher_hex: str, key: str, iv: str) -> dict:
355355
unpadder = padding.PKCS7(128).unpadder()
356356
decrypted = unpadder.update(decrypted_padded) + unpadder.finalize()
357357
return json.loads(decrypted.decode('utf-8'))
358+
if len(ret) < 1000:
359+
raise ValueError(f"加密信息过短疑似风控变化\n{cls.cachef.val=}\n{ret=}\n{meta_info=}")
358360
return _(ret[16:], cls.cachef.val, ret[:16])
359361

360362
@classmethod
@@ -363,7 +365,7 @@ def get_aes_key(cls):
363365
"""获取AES密钥,使用缓存装饰器优化"""
364366
async def fetch():
365367
async with httpx.AsyncClient(headers=cls.headers) as cli:
366-
resp = await cli.get(f"https://{cls.pc_domain}/comic/xsjzmwls")
368+
resp = await cli.get(f"https://{cls.pc_domain}/comic/yiquanchaoren")
367369
return resp.text
368370
try:
369371
loop = get_loop()

variables/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
from assets import res
44

5-
VER = "v2.5.1-beta.3"
5+
VER = "v2.5.1"
66

77
LANG = {
88
"en_US": "English",

0 commit comments

Comments
 (0)