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

This commit is contained in:
Yutousama 2022-04-20 20:18:49 +08:00
parent 149e64d85f
commit 5d4717d7a3

View File

@ -69,7 +69,15 @@ public class GetSeTu extends Model {
url = "https://api.lolicon.app/setu/v2?r18=1&size=regular";
}
if (!StringUtils.isEmpty(key)) {
key=key.replace(" ","|");
if("tag".equals(model)) {
String[] keys = key.split(" ");
StringBuilder keyBuilder = new StringBuilder();
for (String _key : keys) {
keyBuilder.append(_key).append("&tag=");
}
key = keyBuilder.toString();
key=key.substring(0,key.length()-4);
}
if (r18) {
url = "https://api.lolicon.app/setu/v2?" + model + "=" + URLEncoder.encode(key, StandardCharsets.UTF_8) + "&r18=1&size=regular";
} else {
@ -79,6 +87,7 @@ public class GetSeTu extends Model {
if (fuzzyR18) {
url = url.replace("&r18=0", "&r18=2").replace("&r18=1", "&r18=2");
}
System.out.println("url = " + url);
String ret = HttpTools.get(url);
JSONObject json = JSONObject.parseObject(ret);
if (json.getJSONArray("data").size() == 0) {