新闻测试
This commit is contained in:
@@ -282,9 +282,9 @@ 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("articleBody") + 13, doc.html().indexOf(",\"author\":") - 1);
|
result = doc.html().substring(doc.html().indexOf("articleBody") + 14, doc.html().indexOf(",\"author\":") - 1);
|
||||||
list.add(result);
|
list.add(result);
|
||||||
list.add(doc.html().substring(doc.html().indexOf("og:title") + 20, doc.html().indexOf("<meta property=\"og:url") - 5));
|
list.add(doc.html().substring(doc.html().indexOf("og:title") + 19, doc.html().indexOf("<meta property=\"og:url") - 5));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
list.add(e.toString());
|
list.add(e.toString());
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
@@ -170,8 +170,7 @@ public class StockApiController {
|
|||||||
@RequestMapping({"test.do"})
|
@RequestMapping({"test.do"})
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ServerResponse test(@RequestParam("url") String url, @RequestParam("pageNum") Integer pageNum) {
|
public ServerResponse test(@RequestParam("url") String url, @RequestParam("pageNum") Integer pageNum) {
|
||||||
return ServerResponse.createBySuccess(stockService.getNewsInfo(url));
|
String news = stockService.getNews();
|
||||||
/*String news = stockService.getNews();
|
|
||||||
List<String> newsList = Arrays.asList(news.split("<a href="));
|
List<String> newsList = Arrays.asList(news.split("<a href="));
|
||||||
newsList = newsList.subList(1, newsList.size());
|
newsList = newsList.subList(1, newsList.size());
|
||||||
newsList.forEach( n -> {
|
newsList.forEach( n -> {
|
||||||
@@ -193,7 +192,7 @@ public class StockApiController {
|
|||||||
newsRepository.save(siteNews);
|
newsRepository.save(siteNews);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return ServerResponse.createBySuccess();*/
|
return ServerResponse.createBySuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
//印度股票时线-K线
|
//印度股票时线-K线
|
||||||
|
|||||||
Reference in New Issue
Block a user