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