refactor(backend/data):修复财联社电报获取问题

- 修改 market_news_api.go 中的 GoQuery 选择器,从 ".telegraph-list"改为 ".telegraph-content-box"- 更新 openai_api_test.go 中的 TestGetTopNewsList 函数,增加测试日志输出
This commit is contained in:
ArvinLovegood 2025-05-20 10:46:30 +08:00
parent 8b510bce94
commit 1b67e20932
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ func (m MarketNewsApi) GetNewTelegraph(crawlTimeOut int64) *[]models.Telegraph {
//logger.SugaredLogger.Info(string(response.Body()))
document, _ := goquery.NewDocumentFromReader(strings.NewReader(string(response.Body())))
document.Find(".telegraph-list").Each(func(i int, selection *goquery.Selection) {
document.Find(".telegraph-content-box").Each(func(i int, selection *goquery.Selection) {
//logger.SugaredLogger.Info(selection.Text())
telegraph := models.Telegraph{Source: "财联社电报"}
spans := selection.Find("div.telegraph-content-box span")

View File

@ -19,7 +19,8 @@ func TestNewDeepSeekOpenAiConfig(t *testing.T) {
}
func TestGetTopNewsList(t *testing.T) {
GetTopNewsList(30)
news := GetTopNewsList(30)
t.Log(news)
}
func TestSearchGuShiTongStockInfo(t *testing.T) {