diff --git a/src/jmcomic/__init__.py b/src/jmcomic/__init__.py index edd9138..676af90 100644 --- a/src/jmcomic/__init__.py +++ b/src/jmcomic/__init__.py @@ -2,7 +2,7 @@ # 被依赖方 <--- 使用方 # config <--- entity <--- toolkit <--- client <--- option <--- downloader -__version__ = '2.6.0' +__version__ = '2.6.1' from .api import * from .jm_plugin import * diff --git a/src/jmcomic/jm_client_impl.py b/src/jmcomic/jm_client_impl.py index 2cb9452..9f3e8ac 100644 --- a/src/jmcomic/jm_client_impl.py +++ b/src/jmcomic/jm_client_impl.py @@ -431,7 +431,7 @@ class JmHtmlClient(AbstractJmClient): params={ 'page': page, 'o': order_by, - 'folder_id': folder_id, + 'folder': folder_id, } ) diff --git a/src/jmcomic/jm_downloader.py b/src/jmcomic/jm_downloader.py index 1518454..085c52b 100644 --- a/src/jmcomic/jm_downloader.py +++ b/src/jmcomic/jm_downloader.py @@ -294,7 +294,7 @@ class JmDownloader(DownloadCallback): def __exit__(self, exc_type, exc_val, exc_tb): if exc_type is not None: jm_log('dler.exception', - f'{self.__class__.__name__} Exit with exception: {exc_type, exc_val}' + f'{self.__class__.__name__} Exit with exception: {exc_type, str(exc_val)}' ) @classmethod diff --git a/src/jmcomic/jm_toolkit.py b/src/jmcomic/jm_toolkit.py index 7354e60..3bb39b9 100644 --- a/src/jmcomic/jm_toolkit.py +++ b/src/jmcomic/jm_toolkit.py @@ -22,6 +22,7 @@ class JmcomicText: pattern_html_photo_sort = compile(r'var sort = (\d+);') pattern_html_photo_page_arr = compile(r'var page_arr = (.*?);') + pattern_html_b64_decode_content = compile(r'const html = base64DecodeUtf8\("(.*?)"\)') pattern_html_album_album_id = compile(r'.*?:JM(\d+)') pattern_html_album_scramble_id = compile(r'var scramble_id = (\d+);') pattern_html_album_name = compile(r'id="book-name"[^>]*?>([\s\S]*?)<') @@ -106,6 +107,15 @@ class JmcomicText: domain_ls )) + @classmethod + def parse_jm_base64_html(cls, resp_text: str) -> str: + from base64 import b64decode + html_b64 = PatternTool.match_or_default(resp_text, cls.pattern_html_b64_decode_content, None) + if html_b64 is None: + return resp_text + html = b64decode(html_b64).decode() + return html + @classmethod def analyse_jm_photo_html(cls, html: str) -> JmPhotoDetail: return cls.reflect_new_instance( @@ -117,7 +127,7 @@ class JmcomicText: @classmethod def analyse_jm_album_html(cls, html: str) -> JmAlbumDetail: return cls.reflect_new_instance( - html, + cls.parse_jm_base64_html(html), "pattern_html_album_", JmModuleConfig.album_class() )