Skip to content

Commit 9a3d0f1

Browse files
authored
v2.5.5: 优化搜索页面的正则表达式来适配直连域名,app版本号改为v1.6.6,优化文档 (#208)
1 parent 9e41991 commit 9a3d0f1

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

assets/docs/sources/tutorial/5_filter.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class First3ImageDownloader(JmDownloader):
3232

3333
def do_filter(self, detail):
3434
if detail.is_photo():
35-
photo: JmPhotoDetail = iter_objs
35+
photo: JmPhotoDetail = detail
3636
# 支持[start,end,step]
3737
return photo[:3]
3838

39-
return iter_objs
39+
return detail
4040
```
4141

4242

@@ -54,9 +54,9 @@ class FindUpdateDownloader(JmDownloader):
5454

5555
def do_filter(self, detail):
5656
if not detail.is_album():
57-
return iter_objs
57+
return detail
5858

59-
return self.find_update(iter_objs)
59+
return self.find_update(detail)
6060

6161
# 带入漫画id, 章节id(第x章),寻找该漫画下第x章节後的所有章节Id
6262
def find_update(self, album: JmAlbumDetail):

src/jmcomic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# 被依赖方 <--- 使用方
33
# config <--- entity <--- toolkit <--- client <--- option <--- downloader
44

5-
__version__ = '2.5.4'
5+
__version__ = '2.5.5'
66

77
from .api import *
88
from .jm_plugin import *

src/jmcomic/jm_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class JmMagicConstants:
5252
APP_TOKEN_SECRET = '18comicAPP'
5353
APP_TOKEN_SECRET_2 = '18comicAPPContent'
5454
APP_DATA_SECRET = '185Hcomic3PAPP7R'
55-
APP_VERSION = '1.6.4'
55+
APP_VERSION = '1.6.6'
5656
APP_HEADERS_TEMPLATE = {
5757
'Accept-Encoding': 'gzip',
5858
'user-agent': 'Mozilla/5.0 (Linux; Android 9; V1938CT Build/PQ3A.190705.09211555; wv) AppleWebKit/537.36 (KHTML, '
@@ -156,7 +156,7 @@ class JmModuleConfig:
156156
# log时解码url
157157
flag_decode_url_when_logging = True
158158
# 当内置的版本号落后时,使用最新的禁漫app版本号
159-
flag_use_version_newer_if_behind = False
159+
flag_use_version_newer_if_behind = True
160160

161161
# 关联dir_rule的自定义字段与对应的处理函数
162162
# 例如:

src/jmcomic/jm_toolkit.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,7 @@ class JmPageTool:
359359

360360
# 用来提取搜索页面的的album的信息
361361
pattern_html_search_album_info_list = compile(
362-
r'<a href="/album/(\d+)/.+"[\s\S]*?'
363-
r'title="(.*?)"[\s\S]*?'
364-
r'(<div class="label-category" style="">'
365-
r'\n(.*)\n</div>\n<div class="label-sub" style=" ">'
366-
r'(.*?)\n<[\s\S]*?)?'
367-
r'<div class="title-truncate tags .*>\n'
368-
r'(<a[\s\S]*?) </div>'
362+
r'<a href="/album/(\d+)/[\s\S]*?title="(.*?)"([\s\S]*?)<div class="title-truncate tags .*>([\s\S]*?)</div>'
369363
)
370364

371365
# 用来提取分类页面的的album的信息
@@ -383,7 +377,7 @@ class JmPageTool:
383377
# 查找错误,例如 [错误,關鍵字過短,請至少輸入兩個字以上。]
384378
pattern_html_search_error = compile(r'<fieldset>\n<legend>(.*?)</legend>\n<div class=.*?>\n(.*?)\n</div>\n</fieldset>')
385379

386-
pattern_html_search_total = compile(r'<span class="text-white">(\d+)</span> A漫.'), 0
380+
pattern_html_search_total = compile(r'class="text-white">(\d+)</span> A漫.'), 0
387381

388382
# 收藏页面的本子结果
389383
pattern_html_favorite_content = compile(
@@ -424,7 +418,9 @@ def parse_html_to_search_page(cls, html: str) -> JmSearchPage:
424418

425419
album_info_list = cls.pattern_html_search_album_info_list.findall(html)
426420

427-
for (album_id, title, _, label_category, label_sub, tag_text) in album_info_list:
421+
for (album_id, title, _label_category_text, tag_text) in album_info_list:
422+
# 从label_category_text中可以解析出label-category和label-sub
423+
# 这里不作解析,因为没什么用...
428424
tags = cls.pattern_html_search_tags.findall(tag_text)
429425
content.append((
430426
album_id, {

0 commit comments

Comments
 (0)