Skip to content

Commit 3695452

Browse files
authored
Fix parser (#877)
Thanks for the fix! The improved regex pattern will help parse more anime titles correctly. Closes #876 and #924. 🎉
1 parent 0385129 commit 3695452

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

backend/src/module/parser/analyser/raw_parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
EPISODE_RE = re.compile(r"\d+")
99
TITLE_RE = re.compile(
10-
r"(.*|\[.*])( -? \d+|\[\d+]|\[\d+.?[vV]\d]|第\d+[话話集]|\[第?\d+[话話集]]|\[\d+.?END]|[Ee][Pp]?\d+)(.*)"
10+
r"(.*?|\[.*])((?: ?-)? ?\d+ |\[\d+]|\[\d+.?[vV]\d]|第\d+[话話集]|\[第?\d+[话話集]]|\[\d+.?END]|[Ee][Pp]?\d+)(.*)"
1111
)
1212
RESOLUTION_RE = re.compile(r"1080|720|2160|4K")
1313
SOURCE_RE = re.compile(r"B-Global|[Bb]aha|[Bb]ilibili|AT-X|Web")
@@ -185,3 +185,7 @@ def raw_parser(raw: str) -> Episode | None:
185185
if __name__ == "__main__":
186186
title = "[动漫国字幕组&LoliHouse] THE MARGINAL SERVICE - 08 [WebRip 1080p HEVC-10bit AAC][简繁内封字幕]"
187187
print(raw_parser(title))
188+
title = "[北宇治字幕组&LoliHouse] 地。-关于地球的运动- / Chi. Chikyuu no Undou ni Tsuite 03 [WebRip 1080p HEVC-10bit AAC ASSx2][简繁日内封字幕]"
189+
print(raw_parser(title))
190+
title = "[御坂字幕组] 男女之间存在纯友情吗?(不,不存在!!)-01 [WebRip 1080p HEVC10-bit AAC] [简繁日内封] [急招翻校轴]"
191+
print(raw_parser(title))

0 commit comments

Comments
 (0)