@@ -551,9 +551,14 @@ func (m MarketNewsApi) EMDictCode(code string, cache *freecache.Cache) []any {
551551}
552552
553553func (m MarketNewsApi ) TradingViewNews () * []models.TVNews {
554+ client := resty .New ()
555+ config := GetSettingConfig ()
556+ if config .HttpProxyEnabled && config .HttpProxy != "" {
557+ client .SetProxy (config .HttpProxy )
558+ }
554559 TVNews := & []models.TVNews {}
555560 url := "https://news-mediator.tradingview.com/news-flow/v2/news?filter=lang:zh-Hans&filter=provider:panews,reuters&client=screener&streaming=false"
556- resp , err := resty . New (). SetProxy ( "http://127.0.0.1:10809" ). SetTimeout (time .Duration (30 )* time .Second ).R ().
561+ resp , err := client . SetTimeout (time .Duration (5 )* time .Second ).R ().
557562 SetHeader ("Host" , "news-mediator.tradingview.com" ).
558563 SetHeader ("Origin" , "https://cn.tradingview.com" ).
559564 SetHeader ("Referer" , "https://cn.tradingview.com/" ).
@@ -833,7 +838,7 @@ func (m MarketNewsApi) GetPMI() *models.PMIResp {
833838 return res
834839
835840}
836- func (m MarketNewsApi ) GetIndustryReportInfo (infoCode string ) {
841+ func (m MarketNewsApi ) GetIndustryReportInfo (infoCode string ) string {
837842 url := "https://data.eastmoney.com/report/zw_industry.jshtml?infocode=" + infoCode
838843 resp , err := resty .New ().SetTimeout (time .Duration (30 )* time .Second ).R ().
839844 SetHeader ("Host" , "data.eastmoney.com" ).
@@ -843,7 +848,7 @@ func (m MarketNewsApi) GetIndustryReportInfo(infoCode string) {
843848 Get (url )
844849 if err != nil {
845850 logger .SugaredLogger .Errorf ("GetIndustryReportInfo err:%s" , err .Error ())
846- return
851+ return ""
847852 }
848853 body := resp .Body ()
849854 //logger.SugaredLogger.Debugf("GetIndustryReportInfo:%s", body)
@@ -853,7 +858,25 @@ func (m MarketNewsApi) GetIndustryReportInfo(infoCode string) {
853858 //logger.SugaredLogger.Infof("GetIndustryReportInfo:\n%s\n%s", title, content)
854859 markdown , err := util .HTMLToMarkdown (title + content )
855860 if err != nil {
856- return
861+ return ""
857862 }
858863 logger .SugaredLogger .Infof ("GetIndustryReportInfo markdown:\n %s" , markdown )
864+ return markdown
865+ }
866+
867+ func (m MarketNewsApi ) ReutersNew () {
868+ url := "https://www.reuters.com/pf/api/v3/content/fetch/articles-by-section-alias-or-id-v1?query=%7B%22arc-site%22%3A%22reuters%22%2C%22fetch_type%22%3A%22collection%22%2C%22offset%22%3A20%2C%22section_id%22%3A%22%2Fworld%2Fchina%2F%22%2C%22size%22%3A9%2C%22uri%22%3A%22%2Fworld%2Fchina%2F%22%2C%22website%22%3A%22reuters%22%7D&d=300&mxId=00000000&_website=reuters"
869+ resp , err := resty .New ().SetProxy ("http://127.0.0.1:10809" ).SetTimeout (time .Duration (30 )* time .Second ).R ().
870+ SetHeader ("Host" , "www.reuters.com" ).
871+ SetHeader ("Origin" , "https://www.reuters.com" ).
872+ SetHeader ("Referer" , "https://www.reuters.com/world/china/" ).
873+ SetHeader ("User-Agent" , "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0" ).
874+ Get (url )
875+ if err != nil {
876+ logger .SugaredLogger .Errorf ("ReutersNew err:%s" , err .Error ())
877+ return
878+ }
879+ body := resp .Body ()
880+ logger .SugaredLogger .Debugf ("ReutersNew:%s" , body )
881+
859882}
0 commit comments