1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-20 04:31:55 +02:00

Update regex pattern in getTag method

The regular expression pattern used to match tags in URLs in the DanbooruRipper class's getTag method has been updated. Handles both /posts?tags=rakeemspoon&z=2 and /posts?tags=rakeemspoon

([^&]*) -> anything but &
(?:&z=([0-9]+))? -> optional regex -> if & exists, then we check z=numbers
This commit is contained in:
Undid-Iridium
2023-12-09 05:42:21 -05:00
committed by soloturn
parent 4f10a8000b
commit 10538c39f7

View File

@@ -172,7 +172,7 @@ public class DanbooruRipper extends AbstractJSONRipper {
}
private String getTag(URL url) throws MalformedURLException {
gidPattern = Pattern.compile("https?://danbooru.donmai.us/(posts)?.*([?&]tags=([a-zA-Z0-9$_.+!*'(),%-]+))(&|(#.*)?$)");
gidPattern = Pattern.compile("https?://danbooru.donmai.us/(posts)?.*([?&]tags=([^&]*)(?:&z=([0-9]+))?$)");
Matcher m = gidPattern.matcher(url.toExternalForm());
if (m.matches()) {