查询动画关键词获取到id后转id内容

This commit is contained in:
Yutousama 2022-04-08 18:00:00 +08:00
parent 6bc4ff40d5
commit 00ebecb998

View File

@ -331,46 +331,11 @@ public class BangumiTools {
List<String> bangumiList = new ArrayList<>(); List<String> bangumiList = new ArrayList<>();
JSONObject main = search(key); JSONObject main = search(key);
if (main.getInteger("results") > 0) { if (main.getInteger("results") > 0) {
StringBuilder builder = new StringBuilder();
JSONArray list = main.getJSONArray("list"); JSONArray list = main.getJSONArray("list");
Collections.reverse(list); Collections.reverse(list);
for (Object _items : list) { for (Object _items : list) {
JSONObject items= (JSONObject) _items; JSONObject items= (JSONObject) _items;
builder = new StringBuilder(); bangumiList.addAll(reportBangumiInfo(items.getInteger("id")));
builder.append("标题:").append(items.getString("name_cn")).append("\n");
builder.append("日文标题:").append(items.getString("name")).append("\n");
String type;
switch (items.getInteger("type")) {
case 1:
type = "书籍";
break;
case 2:
type = "动画";
break;
case 3:
type = "音乐";
break;
case 4:
type = "游戏";
break;
case 6:
type = "真人剧(Real)";
break;
default:
type = items.getInteger("type") + "";
}
builder.append("类型:").append(type).append("\n");
builder.append("id:").append(items.getInteger("id")).append("\n");
if (items.containsKey("rating")) {
builder.append("Bangumi评分:").append(items.getJSONObject("rating").getFloat("score")).append("\n");
}
builder.append("首播时间:").append(items.getString("air_date")).append("\n");
builder.append("每周 ").append(items.getInteger("air_weekday")).append(" 放送").append("\n");
builder.append("放送集数:").append(items.getInteger("eps")).append("\n");
builder.append("Bangumi地址:").append(items.getString("url")).append("\n");
builder.append("介绍:").append(items.getString("summary")).append("\n");
builder.append("\n").append("\n");
bangumiList.add(builder.toString());
} }
return bangumiList; return bangumiList;
} else { } else {