mirror of
https://github.com/hect0x7/JMComic-Crawler-Python.git
synced 2025-09-26 22:31:30 +08:00
v2.6.1: 更新禁漫网页端本子页面的解析方式 (#449)
Some checks failed
Auto Release & Publish / release (push) Has been cancelled
Some checks failed
Auto Release & Publish / release (push) Has been cancelled
This commit is contained in:
parent
7ffa295e94
commit
d633a5de73
@ -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 *
|
||||
|
@ -431,7 +431,7 @@ class JmHtmlClient(AbstractJmClient):
|
||||
params={
|
||||
'page': page,
|
||||
'o': order_by,
|
||||
'folder_id': folder_id,
|
||||
'folder': folder_id,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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]*?)<')
|
||||
@ -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()
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user