Skip to content

Commit d633a5d

Browse files
authored
v2.6.1: 更新禁漫网页端本子页面的解析方式 (hect0x7#449)
1 parent 7ffa295 commit d633a5d

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

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.6.0'
5+
__version__ = '2.6.1'
66

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

src/jmcomic/jm_client_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def favorite_folder(self,
431431
params={
432432
'page': page,
433433
'o': order_by,
434-
'folder_id': folder_id,
434+
'folder': folder_id,
435435
}
436436
)
437437

src/jmcomic/jm_downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def __enter__(self):
294294
def __exit__(self, exc_type, exc_val, exc_tb):
295295
if exc_type is not None:
296296
jm_log('dler.exception',
297-
f'{self.__class__.__name__} Exit with exception: {exc_type, exc_val}'
297+
f'{self.__class__.__name__} Exit with exception: {exc_type, str(exc_val)}'
298298
)
299299

300300
@classmethod

src/jmcomic/jm_toolkit.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class JmcomicText:
2222
pattern_html_photo_sort = compile(r'var sort = (\d+);')
2323
pattern_html_photo_page_arr = compile(r'var page_arr = (.*?);')
2424

25+
pattern_html_b64_decode_content = compile(r'const html = base64DecodeUtf8\("(.*?)"\)')
2526
pattern_html_album_album_id = compile(r'<span class="number">.*?:JM(\d+)</span>')
2627
pattern_html_album_scramble_id = compile(r'var scramble_id = (\d+);')
2728
pattern_html_album_name = compile(r'id="book-name"[^>]*?>([\s\S]*?)<')
@@ -106,6 +107,15 @@ def analyse_jm_pub_html(cls, html: str, domain_keyword=('jm', 'comic')) -> List[
106107
domain_ls
107108
))
108109

110+
@classmethod
111+
def parse_jm_base64_html(cls, resp_text: str) -> str:
112+
from base64 import b64decode
113+
html_b64 = PatternTool.match_or_default(resp_text, cls.pattern_html_b64_decode_content, None)
114+
if html_b64 is None:
115+
return resp_text
116+
html = b64decode(html_b64).decode()
117+
return html
118+
109119
@classmethod
110120
def analyse_jm_photo_html(cls, html: str) -> JmPhotoDetail:
111121
return cls.reflect_new_instance(
@@ -117,7 +127,7 @@ def analyse_jm_photo_html(cls, html: str) -> JmPhotoDetail:
117127
@classmethod
118128
def analyse_jm_album_html(cls, html: str) -> JmAlbumDetail:
119129
return cls.reflect_new_instance(
120-
html,
130+
cls.parse_jm_base64_html(html),
121131
"pattern_html_album_",
122132
JmModuleConfig.album_class()
123133
)

0 commit comments

Comments
 (0)