@@ -13,7 +13,7 @@ class JmcomicText:
1313 pattern_html_photo_name = compile ('<title>([\s\S]*?)\|.*</title>' )
1414 # pattern_html_photo_data_original_list = compile('data-original="(.*?)" id="album_photo_.+?"')
1515 pattern_html_photo_data_original_domain = compile ('src="https://(.*?)/media/albums/blank' )
16- pattern_html_photo_data_original_0 = compile ('data-original="(.*?)"[ \n ]*?id="album_photo' )
16+ pattern_html_photo_data_original_0 = compile ('data-original="(.*?)"[^> ]*?id="album_photo[^>]*?data-page="0" ' )
1717 pattern_html_photo_keywords = compile ('<meta name="keywords"[\s\S]*?content="(.*?)"' )
1818 pattern_html_photo_series_id = compile ('var series_id = (\d+);' )
1919 pattern_html_photo_sort = compile ('var sort = (\d+);' )
@@ -31,29 +31,29 @@ class JmcomicText:
3131 # 作品
3232 pattern_html_album_works = [
3333 compile ('<span itemprop="author" data-type="works">([\s\S]*?)</span>' ),
34- compile ('<a[\s\S ]*?>(.*?)</a>' )
34+ compile ('<a[^> ]*?>(.*?)</a>' )
3535 ]
3636 # 登場人物
3737 pattern_html_album_actors = [
3838 compile ('<span itemprop="author" data-type="actor">([\s\S]*?)</span>' ),
39- compile ('<a[\s\S ]*?>(.*?)</a>' )
39+ compile ('<a[^> ]*?>(.*?)</a>' )
4040 ]
4141 # 标签
4242 pattern_html_album_tags = [
4343 compile ('<span itemprop="genre" data-type="tags">([\s\S]*?)</span>' ),
44- compile ('<a[\s\S ]*?>(.*?)</a>' )
44+ compile ('<a[^> ]*?>(.*?)</a>' )
4545 ]
4646 # 作者
4747 pattern_html_album_authors = [
4848 compile ('作者: *<span itemprop="author" data-type="author">([\s\S]*?)</span>' ),
49- compile ("<a[\s\S ]*?>(.*?)</a>" ),
49+ compile ("<a[^> ]*?>(.*?)</a>" ),
5050 ]
5151 # 點擊喜歡
5252 pattern_html_album_likes = compile ('<span id="albim_likes_\d+">(.*?)</span>' )
5353 # 觀看
5454 pattern_html_album_views = compile ('<span>(.*?)</span> (次觀看|观看次数)' )
5555 # 評論(div)
56- pattern_html_album_comment_count = compile ('<div class="badge"\n ? * id="total_video_comments">(\d+)</div>' ), 0
56+ pattern_html_album_comment_count = compile ('<div class="badge"[^>]*? id="total_video_comments">(\d+)</div>' ), 0
5757
5858 @classmethod
5959 def parse_to_jm_domain (cls , text : str ):
@@ -169,11 +169,11 @@ def match_field(field_key: str, pattern: Union[Pattern, List[Pattern]], text):
169169
170170 if field_value is None :
171171 if default is None :
172- JmModuleConfig .raise_regex_error_executor (
172+ JmModuleConfig .raises (
173173 f"文本没有匹配上字段:字段名为'{ field_name } ',pattern: [{ pattern } ]" ,
174- html ,
175- field_name ,
176- pattern
174+ re_match_html = html ,
175+ re_match_field_name = field_name ,
176+ re_match_pattern = pattern ,
177177 )
178178 else :
179179 field_value = default
@@ -260,12 +260,12 @@ def parse_html_to_page(cls, html: str) -> JmSearchPage:
260260 match = cls .pattern_html_search_error .search (html )
261261 if match is not None :
262262 topic , reason = match [1 ], match [2 ]
263- JmModuleConfig .raise_regex_error_executor (f'{ topic } : { reason } ' , html )
263+ JmModuleConfig .raises (f'{ topic } : { reason } ' , re_search_html = html )
264264
265265 # 缩小文本范围
266266 match = cls .pattern_html_search_shorten_for .search (html )
267267 if match is None :
268- JmModuleConfig .raise_regex_error_executor ('未匹配到搜索结果' , html )
268+ JmModuleConfig .raises ('未匹配到搜索结果' , re_shorten_html = html )
269269 html = match [0 ]
270270
271271 # 提取结果
0 commit comments