add:新增临时rss下载功能

This commit is contained in:
2022-07-16 18:50:36 +08:00
parent e8fe762c53
commit 238efb7a40
7 changed files with 179 additions and 120 deletions

View File

@@ -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;
}
}