@@ -13,7 +13,7 @@ class JmcomicText:
13
13
pattern_html_photo_name = compile ('<title>([\s\S]*?)\|.*</title>' )
14
14
# pattern_html_photo_data_original_list = compile('data-original="(.*?)" id="album_photo_.+?"')
15
15
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" ' )
17
17
pattern_html_photo_keywords = compile ('<meta name="keywords"[\s\S]*?content="(.*?)"' )
18
18
pattern_html_photo_series_id = compile ('var series_id = (\d+);' )
19
19
pattern_html_photo_sort = compile ('var sort = (\d+);' )
@@ -31,29 +31,29 @@ class JmcomicText:
31
31
# 作品
32
32
pattern_html_album_works = [
33
33
compile ('<span itemprop="author" data-type="works">([\s\S]*?)</span>' ),
34
- compile ('<a[\s\S ]*?>(.*?)</a>' )
34
+ compile ('<a[^> ]*?>(.*?)</a>' )
35
35
]
36
36
# 登場人物
37
37
pattern_html_album_actors = [
38
38
compile ('<span itemprop="author" data-type="actor">([\s\S]*?)</span>' ),
39
- compile ('<a[\s\S ]*?>(.*?)</a>' )
39
+ compile ('<a[^> ]*?>(.*?)</a>' )
40
40
]
41
41
# 标签
42
42
pattern_html_album_tags = [
43
43
compile ('<span itemprop="genre" data-type="tags">([\s\S]*?)</span>' ),
44
- compile ('<a[\s\S ]*?>(.*?)</a>' )
44
+ compile ('<a[^> ]*?>(.*?)</a>' )
45
45
]
46
46
# 作者
47
47
pattern_html_album_authors = [
48
48
compile ('作者: *<span itemprop="author" data-type="author">([\s\S]*?)</span>' ),
49
- compile ("<a[\s\S ]*?>(.*?)</a>" ),
49
+ compile ("<a[^> ]*?>(.*?)</a>" ),
50
50
]
51
51
# 點擊喜歡
52
52
pattern_html_album_likes = compile ('<span id="albim_likes_\d+">(.*?)</span>' )
53
53
# 觀看
54
54
pattern_html_album_views = compile ('<span>(.*?)</span> (次觀看|观看次数)' )
55
55
# 評論(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
57
57
58
58
@classmethod
59
59
def parse_to_jm_domain (cls , text : str ):
@@ -169,11 +169,11 @@ def match_field(field_key: str, pattern: Union[Pattern, List[Pattern]], text):
169
169
170
170
if field_value is None :
171
171
if default is None :
172
- JmModuleConfig .raise_regex_error_executor (
172
+ JmModuleConfig .raises (
173
173
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 ,
177
177
)
178
178
else :
179
179
field_value = default
@@ -260,12 +260,12 @@ def parse_html_to_page(cls, html: str) -> JmSearchPage:
260
260
match = cls .pattern_html_search_error .search (html )
261
261
if match is not None :
262
262
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 )
264
264
265
265
# 缩小文本范围
266
266
match = cls .pattern_html_search_shorten_for .search (html )
267
267
if match is None :
268
- JmModuleConfig .raise_regex_error_executor ('未匹配到搜索结果' , html )
268
+ JmModuleConfig .raises ('未匹配到搜索结果' , re_shorten_html = html )
269
269
html = match [0 ]
270
270
271
271
# 提取结果
0 commit comments