replace standard library 're' uses with 'util.re()'

This commit is contained in:
Mike Fährmann
2025-06-06 12:26:21 +02:00
parent e1f03a5a93
commit b5c88b3d3e
45 changed files with 143 additions and 220 deletions

View File

@@ -11,7 +11,6 @@
from . import booru
from .. import text, util
import collections
import re
BASE_PATTERN = r"(?:https?://)?realbooru\.com"
@@ -72,8 +71,7 @@ class RealbooruExtractor(booru.BooruExtractor):
page = post["_html"]
tag_container = text.extr(page, 'id="tagLink"', '</div>')
tags = collections.defaultdict(list)
pattern = re.compile(
r'<a class="(?:tag-type-)?([^"]+).*?;tags=([^"&]+)')
pattern = util.re(r'<a class="(?:tag-type-)?([^"]+).*?;tags=([^"&]+)')
for tag_type, tag_name in pattern.findall(tag_container):
tags[tag_type].append(text.unescape(text.unquote(tag_name)))
for key, value in tags.items():