爬取新股数据测试

This commit is contained in:
dengli
2023-12-19 15:58:55 +08:00
parent 2db1382b49
commit 0b461fa87b
2 changed files with 4 additions and 14 deletions

View File

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

View File

@@ -207,13 +207,8 @@ public class InvestingInvokerApis {
}
public static void main(String[] args) throws IOException {
JSONObject __market = of().__page(1,100);
System.out.println(__market);
JSONObject __page = of().__page(1, 10);
JSONObject __page_nifty100 = of().__page_nifty100(1, 10);
System.out.println(__page);
System.out.println(__page_nifty100);
String str = "123123123123";
String substring = str.substring(0, str.lastIndexOf("2"));
System.out.println(substring);
}
}