爬取新股数据测试
This commit is contained in:
@@ -262,12 +262,7 @@ 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().substring(doc.html().indexOf("<div class=\"short-video-img\">"),doc.html().lastIndexOf("<div class=\"short-video-img\">"));
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,13 +207,8 @@ public class InvestingInvokerApis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
JSONObject __market = of().__page(1,100);
|
String str = "123123123123";
|
||||||
System.out.println(__market);
|
String substring = str.substring(0, str.lastIndexOf("2"));
|
||||||
|
System.out.println(substring);
|
||||||
JSONObject __page = of().__page(1, 10);
|
|
||||||
JSONObject __page_nifty100 = of().__page_nifty100(1, 10);
|
|
||||||
|
|
||||||
System.out.println(__page);
|
|
||||||
System.out.println(__page_nifty100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user