爬取新股数据测试

This commit is contained in:
dengli
2023-12-19 15:24:33 +08:00
parent 60b98a6b86
commit 2db1382b49

View File

@@ -262,7 +262,12 @@ public class StockService {
.header("Referer", "https://www.business-standard.com/")
.header("Accept-Language", "en-US,en;q=0.9")
.get();
result = doc.html();
// 使用选择器提取所需的数据
Elements newsHeadlines = doc.select("article-listing");
// 遍历提取到的数据并输出
for (Element headline : newsHeadlines) {
result = result + headline.text();
}
} catch (Exception e) {
return ServerResponse.createByErrorMsg(e.toString());
}