fix 每日番剧地址变动

add 涩图日志
This commit is contained in:
yutou 2021-05-24 13:47:45 +08:00
parent 5cf6fc3cd5
commit 3e199749f6
2 changed files with 14 additions and 6 deletions

View File

@ -12,7 +12,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
public class BangumiTools {
private static final String url = "http://api.bgm.tv/";
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=large";
@ -41,13 +41,14 @@ public class BangumiTools {
day = 7;
}
}
if (main != null)
if (main != null) {
for (Object o : main) {
JSONObject json = (JSONObject) o;
if (json.getJSONObject("weekday").getInteger("id") == day) {
return json;
}
}
}
return null;
}
@ -268,6 +269,7 @@ public class BangumiTools {
RedisTools.set("toDayBangumi", builder.toString());
return builder.toString();
} else {
System.out.println("error ");
return RedisTools.get("toDayBangumi");
}
}
@ -312,8 +314,9 @@ public class BangumiTools {
}
builder.append("类型:").append(type).append("\n");
builder.append("id:").append(item.getInteger("id")).append("\n");
if (item.containsKey("rating"))
if (item.containsKey("rating")) {
builder.append("Bangumi评分:").append(item.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");
@ -330,8 +333,9 @@ public class BangumiTools {
}
public static void main(String[] args) {
String str = reportBangumiList();
com.yutou.nas.utils.Log.i(str);
RedisTools.remove("reportToDayBangumi");
String str = reportToDayBangumi();
System.out.println(str);
}
}

View File

@ -2,6 +2,7 @@ package com.yutou.nas.other;
import com.alibaba.fastjson.JSONObject;
import com.yutou.nas.utils.Log;
import com.yutou.nas.utils.QQBotManager;
import com.yutou.nas.utils.RedisTools;
import com.yutou.nas.utils.Tools;
@ -21,7 +22,7 @@ import java.util.TimerTask;
public class QQSetu {
public static void printTodaySetu() {
String redisKey=Tools.getToDayTime() + "_setu";
com.yutou.nas.utils.Log.i("redisKey = " + redisKey);
com.yutou.nas.utils.Log.i("今日涩图 redisKey = " + redisKey);
String js = RedisTools.get(redisKey, 1);
if (js != null) {
JSONObject json = JSONObject.parseObject(js);
@ -56,8 +57,11 @@ public class QQSetu {
builder.append("获得分数 ").append(String.valueOf(setu.getFloat("average"))).append("\n");
builder.append("共有 ").append(String.valueOf(score.getIntValue("userNumber"))).append(" 人参与投票");
QQBotManager.getInstance().sendMessage(info.getLong("group"),builder);
Log.i("今日涩图:"+builder.toString());
}
}
}else {
Log.i("今日没有涩图");
}
}