diff --git a/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java b/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java
index 97c41e7..6ea2d72 100644
--- a/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java
+++ b/src/main/java/com/yutou/nas/Controllers/BTDownloadController.java
@@ -1,6 +1,7 @@
package com.yutou.nas.Controllers;
-import com.yutou.nas.utils.BTDownloadManager;
+import com.yutou.nas.utils.AnimRssManager;
+import com.yutou.nas.utils.DmhyRssDownloadManager;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -11,7 +12,8 @@ public class BTDownloadController {
@ResponseBody
@RequestMapping("/bt/down.do")
public String bt(){
- BTDownloadManager.getInstance().start();
+ DmhyRssDownloadManager.getInstance().start();
+ AnimRssManager.scan();
return "ok";
}
}
diff --git a/src/main/java/com/yutou/nas/NasApplication.java b/src/main/java/com/yutou/nas/NasApplication.java
index 5263e2b..b448bf4 100644
--- a/src/main/java/com/yutou/nas/NasApplication.java
+++ b/src/main/java/com/yutou/nas/NasApplication.java
@@ -1,7 +1,7 @@
package com.yutou.nas;
import com.yutou.nas.Datas.AppData;
-import com.yutou.nas.utils.BTDownloadManager;
+import com.yutou.nas.utils.DmhyRssDownloadManager;
import com.yutou.nas.utils.ConfigTools;
import com.yutou.nas.utils.QQBotManager;
import com.yutou.nas.utils.RedisTools;
@@ -9,7 +9,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
-@Import(BTDownloadManager.class)
+@Import(DmhyRssDownloadManager.class)
@SpringBootApplication
public class NasApplication {
public static final String version = "1.2.16";
diff --git a/src/main/java/com/yutou/nas/utils/AnimRssManager.java b/src/main/java/com/yutou/nas/utils/AnimRssManager.java
new file mode 100644
index 0000000..3d9290d
--- /dev/null
+++ b/src/main/java/com/yutou/nas/utils/AnimRssManager.java
@@ -0,0 +1,35 @@
+package com.yutou.nas.utils;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.yutou.nas.Controllers.UpdateIp;
+
+public class AnimRssManager {
+ public static void scan() {
+ String tmp=HttpTools.https_get("https://tools.yutou233.cn/anim/rss/list.do?type=-1&token=zIrsh9TUZP2lfRW753PannG49E7VJvor",null);
+ System.out.println("tmp = " + tmp);
+ if(tmp==null){
+ return;
+ }
+ JSONObject json= JSON.parseObject(tmp);
+ if(json.getInteger("code")==0){
+ JSONArray data=json.getJSONArray("data");
+ for (Object datum : data) {
+ String url= ((JSONObject) datum).getString("title");
+ download(url);
+ }
+ }
+ }
+
+ private static void download(String url) {
+ JSONObject rss=RssXMLtoJson.toJSON(url);
+ if (rss != null && "ok".equals(rss.getString("status"))) {
+ BTDownloadManager.download(rss.getJSONObject("feed").getString("title"), rss);
+ }
+ }
+
+ public static void main(String[] args) {
+ scan();
+ }
+}
diff --git a/src/main/java/com/yutou/nas/utils/ApplicationInit.java b/src/main/java/com/yutou/nas/utils/ApplicationInit.java
index 1e72121..bfad904 100644
--- a/src/main/java/com/yutou/nas/utils/ApplicationInit.java
+++ b/src/main/java/com/yutou/nas/utils/ApplicationInit.java
@@ -89,7 +89,8 @@ public class ApplicationInit implements ApplicationRunner {
case "21:00":
case "22:00":
case "23:00":
- BTDownloadManager.getInstance().start();
+ DmhyRssDownloadManager.getInstance().start();
+ AnimRssManager.scan();
}
} catch (Exception e) {
Log.e("AppTimer", e);
diff --git a/src/main/java/com/yutou/nas/utils/BTDownloadManager.java b/src/main/java/com/yutou/nas/utils/BTDownloadManager.java
index dc8f131..4880b2a 100644
--- a/src/main/java/com/yutou/nas/utils/BTDownloadManager.java
+++ b/src/main/java/com/yutou/nas/utils/BTDownloadManager.java
@@ -3,124 +3,43 @@ package com.yutou.nas.utils;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
-import com.yutou.nas.Services.IBangumiService;
-import com.yutou.nas.bangumi.AnimationData;
import com.yutou.nas.mybatis.model.BangumiItem;
-import org.jetbrains.annotations.NotNull;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import javax.annotation.Resource;
-import java.io.File;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.concurrent.TimeUnit;
-public class BTDownloadManager implements ApplicationContextAware {
- private static String tmpJson = "{\"status\":\"ok\",\"feed\":{\"url\":\"http://share.dmhy.org/topics/rss/page/1/rss.xml?keyword=无职转生&order=date-desc&sort_id=2&team_id=604\",\"title\":\"c.c动漫-動畫-動漫花園資源網\",\"link\":\"http://share.dmhy.org/\",\"author\":\"\",\"description\":\"動漫花園資訊網是一個動漫愛好者交流的平台,提供最及時,最全面的動畫,漫畫,動漫音樂,動漫下載,BT,ED,動漫遊戲,資訊,分享,交流,讨论.\",\"image\":\"\"},\"items\":[{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][11][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-25 07:11:12\",\"link\":\"http://share.dmhy.org/topics/view/563676_c_c_1_11_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/563676_c_c_1_11_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\n
P.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:LVYN5MDZTBFRNNSPYYXKOKJA5PNGB4FD&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][10][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-15 05:12:42\",\"link\":\"http://share.dmhy.org/topics/view/562725_c_c_1_10_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/562725_c_c_1_10_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:QWEVVDWHSWISWGLOQJWD2PRHP3OYJBD3&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][09][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-14 12:56:28\",\"link\":\"http://share.dmhy.org/topics/view/562653_c_c_1_09_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/562653_c_c_1_09_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:Z6M3M7Y5YTIKY4GGCG7PGEP3WWGORS7T&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][08][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-14 12:56:00\",\"link\":\"http://share.dmhy.org/topics/view/562652_c_c_1_08_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/562652_c_c_1_08_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:BMXA6AZF7BCYQ2CIZOS5I6XPTXUZ2W3E&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][07][BIG5][1080P][MP4]\",\"pubDate\":\"2021-02-23 09:41:47\",\"link\":\"http://share.dmhy.org/topics/view/560768_c_c_1_07_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/560768_c_c_1_07_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:DDIM47E2UJAXRV54JJQFFPJ7SLYZZYQJ&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][06][BIG5][1080P][MP4]\",\"pubDate\":\"2021-02-14 16:51:36\",\"link\":\"http://share.dmhy.org/topics/view/559914_c_c_1_06_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/559914_c_c_1_06_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:MFQR2G2AEZLHXONGKII47FXP2DPE4C3G&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][05][BIG5][1080P][MP4]\",\"pubDate\":\"2021-02-07 16:33:23\",\"link\":\"http://share.dmhy.org/topics/view/559282_c_c_1_05_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/559282_c_c_1_05_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:TUDQWT6OAHYS2LFTCURHRLNZS6PVZXX5&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][04][BIG5][1080P][MP4]\",\"pubDate\":\"2021-01-31 16:36:34\",\"link\":\"http://share.dmhy.org/topics/view/558624_c_c_1_04_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/558624_c_c_1_04_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:MVJ3F3DGW5Y4Z7LONWEWN6GBSQAC3TKQ&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][03][BIG5][1080P][MP4]\",\"pubDate\":\"2021-01-25 05:27:50\",\"link\":\"http://share.dmhy.org/topics/view/558007_c_c_1_03_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/558007_c_c_1_03_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][03][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][03][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:OR6WDFDYDAPOGFR3FY3LLCF25P3PHUTG&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][02][BIG5][1080P][MP4]\",\"pubDate\":\"2021-01-17 16:35:55\",\"link\":\"http://share.dmhy.org/topics/view/557306_c_c_1_02_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/557306_c_c_1_02_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][02][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][02][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:TGON2SU75VGPYQBOHMCXF7M6MNSYS7J3&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]}]}";
- private static ApplicationContext applicationContext;
- @Resource
- IBangumiService bangumiService;
- private static BTDownloadManager manager;
- private static final String DownloadHomePath="/media/yutou/disk_lvm/public/download/";
-
- public static BTDownloadManager getInstance() {
- if (manager == null) {
- manager = new BTDownloadManager();
- if (manager.bangumiService == null) {
- manager.bangumiService = getBean(IBangumiService.class);
- }
- }
- return manager;
- }
-
- private BTDownloadManager() {
- }
-
- public void start() {
- List list = bangumiService.getAllBangumi();
- AnimationData data = new AnimationData();
- Log.i("BT","启动BT检测,总数:"+list.size());
- for (BangumiItem item : list) {
- System.out.println("item.getTitle() = " + item.getTitle());
- }
- File path=new File(DownloadHomePath);
- if(!path.exists()){
- Log.i("BT","下载目录已离线,取消扫描");
- return;
- }
- for (BangumiItem item : list) {
- if(item.getEnable()==0){
- continue;
- }
- item.setAuthor(data.nameToValue(item.getAuthor(), true) + "");
- item.setCategories(data.nameToValue(item.getCategories(), false) + "");
- String url = getRSSUrl(item);
- String _json = HttpTools.get(url);
- if (!StringUtils.isEmpty(_json)) {
- JSONObject json = JSON.parseObject(_json);
- download(item, json);
- } else {
- QQBotManager.getInstance().sendMessage(item.getTitle() + "\n下载失败\n"+getDmhyUrl(item));
- Log.i(item.getTitle() + "\n下载失败");
- }
- }
- }
- private String getDmhyUrl(BangumiItem item){
- String dmhyUrl = "http://share.dmhy.org/topics/rss/page/1/rss.xml?keyword=%s%s&order=date-desc";
- dmhyUrl = String.format(dmhyUrl,
- item.getTitlekey().replace(" ", "+"),
- "-1".equals(item.getCategories()) ? "" : String.format("&sort_id=%s", item.getCategories())
- );
- return dmhyUrl;
- }
- private String getRSSUrl(BangumiItem item) {
- String url = "https://api.rss2json.com/v1/api.json?rss_url=%s&api_key=wtfm5pebya13pnl8rtu51wfgfpte0mb9sap1foll&count=500";
- try {
- return String.format(url, URLEncoder.encode(getDmhyUrl(item), "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- private void download(BangumiItem bangumiItem, JSONObject json) {
+public class BTDownloadManager {
+ protected static final String DownloadHomePath = "/media/yutou/disk_lvm/public/download/";
+ public synchronized static void download(String title, JSONObject json) {
if ("ok".equals(json.getString("status"))) {
JSONArray items = json.getJSONArray("items");
for (Object _item : items) {
JSONObject item = (JSONObject) _item;
//确认是为下载过的
- if (!isDownload(bangumiItem.getTitle(), item.getString("title"))) {
+ if (!isDownload(title, item.getString("title"))) {
//添加到下载器
- if (download(bangumiItem.getTitle(), item.getJSONObject("enclosure").getString("link"))) {
+ if (download(title, item.getJSONObject("enclosure").getString("link"))) {
//发通知到QQ
- JSONArray array = getDownload(bangumiItem.getTitle());
+ JSONArray array = getDownload(title);
array.add(item.getString("title"));
- RedisTools.set(bangumiItem.getTitle(), array.toJSONString());
+ RedisTools.set(title, array.toJSONString());
if (item.containsKey("thumbnail")) {
onSend(item.getString("thumbnail"), item);
} else {
onSend(null, item);
}
- }else{
- Log.i("BT","添加到下载器失败:"+item.getString("title"));
+ } else {
+ Log.i("BT", "添加到下载器失败:" + item.getString("title"));
}
- }else{
- Log.i("BT","已下载过:"+item.getString("title"));
+ } else {
+ Log.i("BT", "已下载过:" + item.getString("title"));
}
}
- }else{
- Log.i("BT","rss2json转换失败:"+bangumiItem.getTitle());
+ } else {
+ Log.i("BT", "rss2json转换失败:" + title);
}
}
- private void onSend(String fileUrl, JSONObject item) {
+ private static void onSend(String fileUrl, JSONObject item) {
String text = "启动下载器\n已提交到下载:" + item.getString("title");
Log.i(text);
if (fileUrl == null) {
@@ -130,15 +49,15 @@ public class BTDownloadManager implements ApplicationContextAware {
}
}
- public boolean download(String title, String url) {
+ private static boolean download(String title, String url) {
try {
String exec = String.format("transmission-remote -n yutou:34864394 -w \"%sanim/%s\" -a \"%s\" "
- ,DownloadHomePath
+ , DownloadHomePath
, title
, url
);
Log.i(exec);
- Process process=Runtime.getRuntime().exec(new String[]{"sh"
+ Process process = Runtime.getRuntime().exec(new String[]{"sh"
, "-c"
, exec});
process.waitFor(120, TimeUnit.SECONDS);
@@ -149,7 +68,7 @@ public class BTDownloadManager implements ApplicationContextAware {
return false;
}
- private JSONArray getDownload(String title) {
+ private static JSONArray getDownload(String title) {
String _title = RedisTools.get(title);
if (StringUtils.isEmpty(_title)) {
return new JSONArray();
@@ -157,7 +76,7 @@ public class BTDownloadManager implements ApplicationContextAware {
return JSON.parseArray(_title);
}
- private boolean isDownload(String title, String key) {
+ private static boolean isDownload(String title, String key) {
String _title = RedisTools.get(title);
JSONArray array;
if (StringUtils.isEmpty(_title)) {
@@ -167,19 +86,4 @@ public class BTDownloadManager implements ApplicationContextAware {
}
return array.contains(key);
}
-
- public static void main(String[] args) {
-
- }
-
- @Override
- public void setApplicationContext(@NotNull ApplicationContext applicationContext) throws BeansException {
- if (BTDownloadManager.applicationContext == null) {
- BTDownloadManager.applicationContext = applicationContext;
- }
- }
-
- private static T getBean(Class clazz) {
- return applicationContext.getBean(clazz);
- }
}
diff --git a/src/main/java/com/yutou/nas/utils/DmhyRssDownloadManager.java b/src/main/java/com/yutou/nas/utils/DmhyRssDownloadManager.java
new file mode 100644
index 0000000..1bb8039
--- /dev/null
+++ b/src/main/java/com/yutou/nas/utils/DmhyRssDownloadManager.java
@@ -0,0 +1,94 @@
+package com.yutou.nas.utils;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.yutou.nas.Services.IBangumiService;
+import com.yutou.nas.bangumi.AnimationData;
+import com.yutou.nas.mybatis.model.BangumiItem;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+public class DmhyRssDownloadManager implements ApplicationContextAware {
+ private static String tmpJson = "{\"status\":\"ok\",\"feed\":{\"url\":\"http://share.dmhy.org/topics/rss/page/1/rss.xml?keyword=无职转生&order=date-desc&sort_id=2&team_id=604\",\"title\":\"c.c动漫-動畫-動漫花園資源網\",\"link\":\"http://share.dmhy.org/\",\"author\":\"\",\"description\":\"動漫花園資訊網是一個動漫愛好者交流的平台,提供最及時,最全面的動畫,漫畫,動漫音樂,動漫下載,BT,ED,動漫遊戲,資訊,分享,交流,讨论.\",\"image\":\"\"},\"items\":[{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][11][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-25 07:11:12\",\"link\":\"http://share.dmhy.org/topics/view/563676_c_c_1_11_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/563676_c_c_1_11_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:LVYN5MDZTBFRNNSPYYXKOKJA5PNGB4FD&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][10][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-15 05:12:42\",\"link\":\"http://share.dmhy.org/topics/view/562725_c_c_1_10_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/562725_c_c_1_10_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:QWEVVDWHSWISWGLOQJWD2PRHP3OYJBD3&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][09][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-14 12:56:28\",\"link\":\"http://share.dmhy.org/topics/view/562653_c_c_1_09_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/562653_c_c_1_09_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:Z6M3M7Y5YTIKY4GGCG7PGEP3WWGORS7T&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][08][BIG5][1080P][MP4]\",\"pubDate\":\"2021-03-14 12:56:00\",\"link\":\"http://share.dmhy.org/topics/view/562652_c_c_1_08_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/562652_c_c_1_08_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:BMXA6AZF7BCYQ2CIZOS5I6XPTXUZ2W3E&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][07][BIG5][1080P][MP4]\",\"pubDate\":\"2021-02-23 09:41:47\",\"link\":\"http://share.dmhy.org/topics/view/560768_c_c_1_07_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/560768_c_c_1_07_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:DDIM47E2UJAXRV54JJQFFPJ7SLYZZYQJ&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][06][BIG5][1080P][MP4]\",\"pubDate\":\"2021-02-14 16:51:36\",\"link\":\"http://share.dmhy.org/topics/view/559914_c_c_1_06_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/559914_c_c_1_06_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:MFQR2G2AEZLHXONGKII47FXP2DPE4C3G&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][05][BIG5][1080P][MP4]\",\"pubDate\":\"2021-02-07 16:33:23\",\"link\":\"http://share.dmhy.org/topics/view/559282_c_c_1_05_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/559282_c_c_1_05_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:TUDQWT6OAHYS2LFTCURHRLNZS6PVZXX5&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][04][BIG5][1080P][MP4]\",\"pubDate\":\"2021-01-31 16:36:34\",\"link\":\"http://share.dmhy.org/topics/view/558624_c_c_1_04_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/558624_c_c_1_04_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:MVJ3F3DGW5Y4Z7LONWEWN6GBSQAC3TKQ&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][03][BIG5][1080P][MP4]\",\"pubDate\":\"2021-01-25 05:27:50\",\"link\":\"http://share.dmhy.org/topics/view/558007_c_c_1_03_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/558007_c_c_1_03_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][03][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][03][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:OR6WDFDYDAPOGFR3FY3LLCF25P3PHUTG&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]},{\"title\":\"\u200B[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][02][BIG5][1080P][MP4]\",\"pubDate\":\"2021-01-17 16:35:55\",\"link\":\"http://share.dmhy.org/topics/view/557306_c_c_1_02_BIG5_1080P_MP4.html\",\"guid\":\"http://share.dmhy.org/topics/view/557306_c_c_1_02_BIG5_1080P_MP4.html\",\"author\":\"lleeopen\",\"thumbnail\":\"https://img.vim-cn.com/43/a8c19df5571ea68c64ed4945cc0187bd82e2f1.jpg\",\"description\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][02][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"content\":\"\\n[c.c動漫][1月新番][無職轉生~到了異世界就拿出真本事~][02][BIG5][1080P][MP4]
\\nP.s.請使用正規的BT軟件下載(utorrent、qbittorrent、bitcomet),下載完成之後不要立即關閉下載軟件,盡量保持上傳一段時間~~
\\n
\\n\",\"enclosure\":{\"link\":\"magnet:?xt=urn:btih:TGON2SU75VGPYQBOHMCXF7M6MNSYS7J3&dn=&tr=http://104.238.198.186:8000/announce&tr=udp://104.238.198.186:8000/announce&tr=http://tracker.openbittorrent.com:80/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=http://tracker4.itzmx.com:2710/announce&tr=http://tracker.publicbt.com:80/announce&tr=http://tracker.prq.to/announce&tr=http://open.acgtracker.com:1096/announce&tr=https://t-115.rhcloud.com/only_for_ylbud&tr=http://tracker1.itzmx.com:8080/announce&tr=http://tracker2.itzmx.com:6961/announce&tr=udp://tracker1.itzmx.com:8080/announce&tr=udp://tracker2.itzmx.com:6961/announce&tr=udp://tracker3.itzmx.com:6961/announce&tr=udp://tracker4.itzmx.com:2710/announce&tr=http://tr.bangumi.moe:6969/announce&tr=http://t.nyaatracker.com/announce&tr=http://open.nyaatorrents.info:6544/announce&tr=http://t2.popgo.org:7456/annonce&tr=http://share.camoe.cn:8080/announce&tr=http://opentracker.acgnx.se/announce&tr=http://tracker.acgnx.se/announce&tr=http://nyaa.tracker.wf:7777/announce&tr=http://t.acg.rip:6699/announce&tr=http://opentracker.acgnx.com:6869/announce\",\"type\":\"application/x-bittorrent\",\"length\":1},\"categories\":[\"動畫\"]}]}";
+ private static ApplicationContext applicationContext;
+ @Resource
+ IBangumiService bangumiService;
+ private static DmhyRssDownloadManager manager;
+
+
+ public static DmhyRssDownloadManager getInstance() {
+ if (manager == null) {
+ manager = new DmhyRssDownloadManager();
+ if (manager.bangumiService == null) {
+ manager.bangumiService = getBean(IBangumiService.class);
+ }
+ }
+ return manager;
+ }
+
+ private DmhyRssDownloadManager() {
+ }
+
+ public void start() {
+ List list = bangumiService.getAllBangumi();
+ AnimationData data = new AnimationData();
+ Log.i("BT", "启动BT检测,总数:" + list.size());
+ for (BangumiItem item : list) {
+ System.out.println("item.getTitle() = " + item.getTitle());
+ }
+ File path = new File(BTDownloadManager.DownloadHomePath);
+ if (!path.exists()) {
+ Log.i("BT", "下载目录已离线,取消扫描");
+ return;
+ }
+ for (BangumiItem item : list) {
+ if (item.getEnable() == 0) {
+ continue;
+ }
+ item.setAuthor(data.nameToValue(item.getAuthor(), true) + "");
+ item.setCategories(data.nameToValue(item.getCategories(), false) + "");
+
+ JSONObject json = RssXMLtoJson.toJSON(getDmhyUrl(item));
+ if (json != null) {
+ BTDownloadManager.download(item.getTitle(), json);
+ } else {
+ QQBotManager.getInstance().sendMessage(item.getTitle() + "\n下载失败\n" + getDmhyUrl(item));
+ Log.i(item.getTitle() + "\n下载失败");
+ }
+ }
+ }
+
+ private String getDmhyUrl(BangumiItem item) {
+ String dmhyUrl = "http://share.dmhy.org/topics/rss/page/1/rss.xml?keyword=%s%s&order=date-desc";
+ dmhyUrl = String.format(dmhyUrl,
+ item.getTitlekey().replace(" ", "+"),
+ "-1".equals(item.getCategories()) ? "" : String.format("&sort_id=%s", item.getCategories())
+ );
+ return dmhyUrl;
+ }
+
+
+
+ public static void main(String[] args) {
+
+ }
+
+ @Override
+ public void setApplicationContext(@NotNull ApplicationContext applicationContext) throws BeansException {
+ if (DmhyRssDownloadManager.applicationContext == null) {
+ DmhyRssDownloadManager.applicationContext = applicationContext;
+ }
+ }
+
+ private static T getBean(Class clazz) {
+ return applicationContext.getBean(clazz);
+ }
+}
diff --git a/src/main/java/com/yutou/nas/utils/RssXMLtoJson.java b/src/main/java/com/yutou/nas/utils/RssXMLtoJson.java
new file mode 100644
index 0000000..e9920a7
--- /dev/null
+++ b/src/main/java/com/yutou/nas/utils/RssXMLtoJson.java
@@ -0,0 +1,23 @@
+package com.yutou.nas.utils;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+public class RssXMLtoJson {
+ public static JSONObject toJSON(String xmlUrl){
+ String url = "https://api.rss2json.com/v1/api.json?rss_url=%s&api_key=wtfm5pebya13pnl8rtu51wfgfpte0mb9sap1foll&count=500";
+ try {
+ String ret = HttpTools.get(String.format(url, URLEncoder.encode(xmlUrl, "UTF-8")));
+ if(ret!=null){
+ return JSON.parseObject(ret, JSONObject.class);
+ }
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return null;
+ }
+}