大盘数据更换moneycontrol 数据源

This commit is contained in:
gavin
2024-07-26 14:53:50 +08:00
parent b321fd9d4e
commit 2e4449bd64
2 changed files with 18 additions and 19 deletions

View File

@@ -187,18 +187,17 @@ public class TodayApis {
//获取详情
public static JSONObject getStockDetail(String exchange,String coCode){
String url = String.format("https://marketapi.intoday.in/widget/stockdetail/pullview?co_code=%s&exchange=%s",coCode,exchange);
String url = String.format("https://priceapi.moneycontrol.com/pricefeed/notapplicable/inidicesindia/%s",exchange);
String str = get(url);
JSONObject object = JSON.parseObject(str);
boolean bool = false;
if(object.containsKey("success")){
bool = object.getBoolean("success");
if(object.containsKey("code")){
bool = object.getInteger("code") == 200;
}
if(!bool){
return new JSONObject();
}
JSONArray jsonArray = JSON.parseArray(object.getString("data"));
JSONObject entity = JSON.parseObject(jsonArray.get(0).toString());
JSONObject entity = JSON.parseObject(object.getString("data"));
return entity;
}