Commit 15c7fc9b authored by Tiger Ton's avatar Tiger Ton
Browse files

处理 keyword 中的空格

parent d5ef500d
Showing with 4 additions and 2 deletions
+4 -2
package cn.urstudio.cn.urhot.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.net.URLEncodeUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
......@@ -49,7 +50,7 @@ public class PublicController {
List<Map<String, Object>> resultList = new ArrayList<>();
for (int i = 0; i < twitterKeywordsArray.size(); i++) {
//获取twitter关键词
String twitterKeyword = twitterKeywordsArray.getJSONObject(i).getStr("name");
String twitterKeyword = URLEncodeUtil.encode(twitterKeywordsArray.getJSONObject(i).getStr("name"));
String url = rssHubUrl + "/twitter/keyword/" + twitterKeyword + "?readable=true&authorNameBold=true&widthOfPics=50&heightOfPics=50&limit=100";
try {
Map<String, Object> resultData = RssUtils.load(url, cacheEnable, cachePath, "twitter_keyword", twitterKeyword);
......@@ -107,7 +108,8 @@ public class PublicController {
String url = "";
switch (type) {
case "twitter_keyword":
url = rssHubUrl + "/twitter/keyword/" + name + "?readable=true&authorNameBold=true&widthOfPics=50&heightOfPics=50&limit=100";
url = rssHubUrl + "/twitter/keyword/" + URLEncodeUtil.encode(name) + "?readable=true&authorNameBold=true&widthOfPics=50&heightOfPics=50&limit=100";
break;
case "twitter_user":
url = rssHubUrl + "/twitter/user/" + name + "?readable=true&authorNameBold=true&widthOfPics=50&heightOfPics=50&limit=100&excludeReplies=true&includeRts=false";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment