Skip to content
Merged

Dev #449

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.6.0'
__version__ = '2.6.1'

from .api import *
from .jm_plugin import *
Expand Down
2 changes: 1 addition & 1 deletion src/jmcomic/jm_client_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def favorite_folder(self,
params={
'page': page,
'o': order_by,
'folder_id': folder_id,
'folder': folder_id,
}
)

Expand Down
2 changes: 1 addition & 1 deletion src/jmcomic/jm_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def wrapper(self, *args, **kwargs):
self: JmDownloader
try:
return func(self, *args, **kwargs)

Check failure on line 11 in src/jmcomic/jm_downloader.py

View workflow job for this annotation

GitHub Actions / test (3.11, ubuntu-latest)

test_partial_exception

Check failure on line 11 in src/jmcomic/jm_downloader.py

View workflow job for this annotation

GitHub Actions / test (3.10, ubuntu-latest)

test_partial_exception

Check failure on line 11 in src/jmcomic/jm_downloader.py

View workflow job for this annotation

GitHub Actions / test (3.9, ubuntu-latest)

test_partial_exception

Check failure on line 11 in src/jmcomic/jm_downloader.py

View workflow job for this annotation

GitHub Actions / test (3.9, ubuntu-latest)

test_partial_exception
except Exception as e:
detail: JmBaseEntity = args[0]
if detail.is_image():
Expand All @@ -21,7 +21,7 @@
jm_log('photo.failed', f'章节下载失败: [{detail.id}], 异常: [{e}]')
self.download_failed_photo.append((detail, e))

raise e

Check failure on line 24 in src/jmcomic/jm_downloader.py

View workflow job for this annotation

GitHub Actions / test (3.10, ubuntu-latest)

test_partial_exception

Check failure on line 24 in src/jmcomic/jm_downloader.py

View workflow job for this annotation

GitHub Actions / test (3.9, ubuntu-latest)

test_partial_exception

return wrapper

Expand Down Expand Up @@ -294,7 +294,7 @@
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
Expand Down
12 changes: 11 additions & 1 deletion src/jmcomic/jm_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<span class="number">.*?:JM(\d+)</span>')
pattern_html_album_scramble_id = compile(r'var scramble_id = (\d+);')
pattern_html_album_name = compile(r'id="book-name"[^>]*?>([\s\S]*?)<')
Expand Down Expand Up @@ -106,6 +107,15 @@ def analyse_jm_pub_html(cls, html: str, domain_keyword=('jm', 'comic')) -> List[
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(
Expand All @@ -117,7 +127,7 @@ def analyse_jm_photo_html(cls, html: str) -> JmPhotoDetail:
@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()
)
Expand Down
Loading