涩图模块:空格替换成|以便支持多关键词搜索

This commit is contained in:
Yutousama 2022-04-20 20:20:42 +08:00
parent 5d4717d7a3
commit dfd60919ad

View File

@ -69,19 +69,19 @@ public class GetSeTu extends Model {
url = "https://api.lolicon.app/setu/v2?r18=1&size=regular"; url = "https://api.lolicon.app/setu/v2?r18=1&size=regular";
} }
if (!StringUtils.isEmpty(key)) { if (!StringUtils.isEmpty(key)) {
if("tag".equals(model)) { if ("tag".equals(model)) {
String[] keys = key.split(" "); String[] keys = key.split(" ");
StringBuilder keyBuilder = new StringBuilder(); StringBuilder keyBuilder = new StringBuilder();
for (String _key : keys) { for (String _key : keys) {
keyBuilder.append(_key).append("&tag="); keyBuilder.append(_key).append("&tag=");
} }
key = keyBuilder.toString(); key = keyBuilder.toString();
key=key.substring(0,key.length()-4); key = key.substring(0, key.length() - 5);
} }
if (r18) { if (r18) {
url = "https://api.lolicon.app/setu/v2?" + model + "=" + URLEncoder.encode(key, StandardCharsets.UTF_8) + "&r18=1&size=regular"; url = "https://api.lolicon.app/setu/v2?" + model + "=" + key + "&r18=1&size=regular";
} else { } else {
url = "https://api.lolicon.app/setu/v2?" + model + "=" + URLEncoder.encode(key, StandardCharsets.UTF_8) + "&r18=0&size=regular"; url = "https://api.lolicon.app/setu/v2?" + model + "=" + key + "&r18=0&size=regular";
} }
} }
if (fuzzyR18) { if (fuzzyR18) {