新闻测试
This commit is contained in:
@@ -272,8 +272,9 @@ public class StockService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getNewsInfo(String url) {
|
||||
public List<String> getNewsInfo(String url) {
|
||||
String result = "";
|
||||
List<String> list = new ArrayList<>();
|
||||
try {
|
||||
// 使用Jsoup连接到网页
|
||||
Document doc = Jsoup.connect(url)
|
||||
@@ -281,12 +282,14 @@ public class StockService {
|
||||
.header("Referer", "https://www.business-standard.com/")
|
||||
.header("Accept-Language", "en-US,en;q=0.9")
|
||||
.get();
|
||||
//result = doc.html().substring(doc.html().indexOf("articleBody") + 13, doc.html().indexOf(",\"author\":") - 1);
|
||||
result = doc.html();
|
||||
result = doc.html().substring(doc.html().indexOf("articleBody") + 13, doc.html().indexOf(",\"author\":") - 1);
|
||||
list.add(result);
|
||||
list.add(doc.html().substring(doc.html().indexOf("twitter:description") + 32, doc.html().indexOf("<meta property=\"article:published_time") - 7));
|
||||
} catch (Exception e) {
|
||||
return e.toString();
|
||||
list.add(e.toString());
|
||||
return list;
|
||||
}
|
||||
return result;
|
||||
return list;
|
||||
}
|
||||
|
||||
public ServerResponse getStock(int pageNum, int pageSize, String keyWords, String stockPlate, String stockType,
|
||||
|
||||
Reference in New Issue
Block a user