查询动画仅限动画模块

This commit is contained in:
Yutousama 2022-04-08 17:49:52 +08:00
parent 6b19fa8f2f
commit 6bc4ff40d5

View File

@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.yutou.qqbot.QQBotManager;
import com.yutou.qqbot.models.Model;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -12,8 +14,8 @@ import java.util.*;
public class BangumiTools {
private static final String url = "https://api.bgm.tv/";
private static final String toDayBangumi = url + "calendar";
private static final String BangumiInfo = url + "/subject/%s?responseGroup=large";
private static final String SearchBangumi = url + "/search/subject/%s?responseGroup=largem&type=2";
private static final String BangumiInfo = url + "subject/%s?responseGroup=large";
private static final String SearchBangumi = url + "search/subject/%s?responseGroup=large&type=2";
/**
* 获取番剧列表
@ -114,7 +116,7 @@ public class BangumiTools {
* @return 详细信息
*/
public static JSONObject search(String key) {
String str = HttpTools.get(String.format(SearchBangumi, key));
String str = HttpTools.get(String.format(SearchBangumi, URLEncoder.encode(key, StandardCharsets.UTF_8)));
return JSONObject.parseObject(str);
}
@ -330,15 +332,15 @@ public class BangumiTools {
JSONObject main = search(key);
if (main.getInteger("results") > 0) {
StringBuilder builder = new StringBuilder();
List<JSONObject> list = main.getJSONArray("list").toJavaList(JSONObject.class);
JSONArray list = main.getJSONArray("list");
Collections.reverse(list);
for (Object items : list) {
JSONObject item = (JSONObject) items;
for (Object _items : list) {
JSONObject items= (JSONObject) _items;
builder = new StringBuilder();
builder.append("标题:").append(item.getString("name_cn")).append("\n");
builder.append("日文标题:").append(item.getString("name")).append("\n");
builder.append("标题:").append(items.getString("name_cn")).append("\n");
builder.append("日文标题:").append(items.getString("name")).append("\n");
String type;
switch (item.getInteger("type")) {
switch (items.getInteger("type")) {
case 1:
type = "书籍";
break;
@ -355,18 +357,18 @@ public class BangumiTools {
type = "真人剧(Real)";
break;
default:
type = item.getInteger("type") + "";
type = items.getInteger("type") + "";
}
builder.append("类型:").append(type).append("\n");
builder.append("id:").append(item.getInteger("id")).append("\n");
if (item.containsKey("rating")) {
builder.append("Bangumi评分:").append(item.getJSONObject("rating").getFloat("score")).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(item.getString("air_date")).append("\n");
builder.append("每周 ").append(item.getInteger("air_weekday")).append(" 放送").append("\n");
builder.append("放送集数:").append(item.getInteger("eps")).append("\n");
builder.append("Bangumi地址:").append(item.getString("url")).append("\n");
builder.append("介绍:").append(item.getString("summary")).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());
}
@ -377,75 +379,10 @@ public class BangumiTools {
}
}
public static void saveInfoToJellyfin(String name) {
JSONObject json = search(name);
JSONArray array = json.getJSONArray("list");
int id = 0;
StringBuilder bangumiName = new StringBuilder();
for (Object o : array) {
JSONObject _item = (JSONObject) o;
bangumiName.append(_item.getString("name_cn"))
.append(":")
.append(Model.QQGroupCommands.QQ_BANGUMI_INFO)
.append(_item.getString("id"))
.append("\n");
if (_item.getString("name_cn").equals(name)) {
id = _item.getInteger("id");
break;
}
}
if (id == 0) {
QQBotManager.getInstance().sendMessage("没有与《" + name + "》完全匹配的信息,请填写。 \n" + bangumiName.toString());
return;
}
json = getBangumiInfo(id);
}
public static void main(String[] args) {
/* JSONObject json = search("小林家的龙女仆S");
System.out.println(json);
json = getBangumiInfo(274234);
System.err.println("------------");
System.out.println(json);*/
byte[] user=new byte[] {
78, 106, 73, 49, 79, 122, 65, 51, 89, 71,
65, 117, 78, 106, 78, 109, 78, 122, 99, 55,
89, 109, 85, 61 };
byte[] password=new byte[] {
89, 87, 66, 108, 79, 109, 90, 110, 78, 106,
65, 117, 79, 109, 74, 109, 78, 122, 65, 120,
79, 50, 89, 61 };
user=Base64.getDecoder().decode(user);
password=Base64.getDecoder().decode(password);
String showUser=new String(a(user));
String showPassword=new String(a(password));
System.out.println("user = "+showUser);
System.out.println("pass = "+showPassword);
String[] t1=showUser.split("-");
int t11=Integer.parseInt(t1[0],16);
int t12=Integer.parseInt(t1[1],16);
System.out.println("t11 = " + t11);
System.out.println("t12 = " + t12);
System.out.println((t11-t12));
int index=0;
for (int i = 0; i <= 13; i++) {
String t=i+"";
if(t.contains("1")){
index++;
System.err.println(t);
List<String> list = BangumiTools.reportSearchBangumi("处刑少女的生存之道");
for (String s : list) {
System.out.println(s);
}
}
System.out.println(index);
System.out.println(15);
}
public static byte[] a(byte[] tmp){
byte[] data=tmp.clone();
for (byte i = 0; i < data.length; i++) {
data[i]= (byte) (data[i]^3);
}
return data;
}
}