Skip to content

Commit

Permalink
v2.5.5: 优化搜索页面的正则表达式来适配直连域名,app版本号改为v1.6.6,优化文档 (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
hect0x7 authored Jan 31, 2024
1 parent 9e41991 commit 9a3d0f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
8 changes: 4 additions & 4 deletions assets/docs/sources/tutorial/5_filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class First3ImageDownloader(JmDownloader):

def do_filter(self, detail):
if detail.is_photo():
photo: JmPhotoDetail = iter_objs
photo: JmPhotoDetail = detail
# 支持[start,end,step]
return photo[:3]

return iter_objs
return detail
```


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

def do_filter(self, detail):
if not detail.is_album():
return iter_objs
return detail

return self.find_update(iter_objs)
return self.find_update(detail)

# 带入漫画id, 章节id(第x章),寻找该漫画下第x章节後的所有章节Id
def find_update(self, album: JmAlbumDetail):
Expand Down
2 changes: 1 addition & 1 deletion src/jmcomic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# 被依赖方 <--- 使用方
# config <--- entity <--- toolkit <--- client <--- option <--- downloader

__version__ = '2.5.4'
__version__ = '2.5.5'

from .api import *
from .jm_plugin import *
Expand Down
4 changes: 2 additions & 2 deletions src/jmcomic/jm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class JmMagicConstants:
APP_TOKEN_SECRET = '18comicAPP'
APP_TOKEN_SECRET_2 = '18comicAPPContent'
APP_DATA_SECRET = '185Hcomic3PAPP7R'
APP_VERSION = '1.6.4'
APP_VERSION = '1.6.6'
APP_HEADERS_TEMPLATE = {
'Accept-Encoding': 'gzip',
'user-agent': 'Mozilla/5.0 (Linux; Android 9; V1938CT Build/PQ3A.190705.09211555; wv) AppleWebKit/537.36 (KHTML, '
Expand Down Expand Up @@ -156,7 +156,7 @@ class JmModuleConfig:
# log时解码url
flag_decode_url_when_logging = True
# 当内置的版本号落后时,使用最新的禁漫app版本号
flag_use_version_newer_if_behind = False
flag_use_version_newer_if_behind = True

# 关联dir_rule的自定义字段与对应的处理函数
# 例如:
Expand Down
14 changes: 5 additions & 9 deletions src/jmcomic/jm_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,13 +359,7 @@ class JmPageTool:

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

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

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

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

album_info_list = cls.pattern_html_search_album_info_list.findall(html)

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

0 comments on commit 9a3d0f1

Please sign in to comment.