diff --git a/src/quantitative_analysis/us_stock_price_collector.py b/src/quantitative_analysis/us_stock_price_collector.py index cdccce7..3053e16 100644 --- a/src/quantitative_analysis/us_stock_price_collector.py +++ b/src/quantitative_analysis/us_stock_price_collector.py @@ -94,12 +94,21 @@ class USStockPriceCollector: ) self.base_url = "https://push2.eastmoney.com/api/qt/clist/get" self.headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", - "Accept": "application/json, text/plain, */*", - "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", - "Origin": "https://quote.eastmoney.com", - "Referer": "https://quote.eastmoney.com/", - } + "accept": "*/*:*/*", + "accept-encoding": "gzip, deflate, br, zstd:gzip, deflate, br, zstd", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8:zh-CN,zh;q=0.9,en;q=0.8", + "connection": "keep-alive:keep-alive", + "cookie": "qgqp_b_id=3d1376c8b3609b85ddd613ff70797b21; st_nvi=OkigGRrjz_ZnTtL_7eE4-4595; nid=0820fd3f15fe4f7c0164f8a7eff85c5f; nid_create_time=1754027308372; gvi=p9WxDMFjnfkCUiL8CQ3ex015a; gvi_create_time=1754027308372; fullscreengg=1; fullscreengg2=1; st_si=11531712238902; st_asi=delete; st_pvi=49494569999152; st_sp=2025-05-12%2009%3A11%3A41; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink; st_sn=11; st_psi=20250904172534993-113200301321-0920486271:qgqp_b_id=3d1376c8b3609b85ddd613ff70797b21; st_nvi=OkigGRrjz_ZnTtL_7eE4-4595; nid=0820fd3f15fe4f7c0164f8a7eff85c5f; nid_create_time=1754027308372; gvi=p9WxDMFjnfkCUiL8CQ3ex015a; gvi_create_time=1754027308372; fullscreengg=1; fullscreengg2=1; st_si=11531712238902; st_asi=delete; st_pvi=49494569999152; st_sp=2025-05-12%2009%3A11%3A41; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink; st_sn=11; st_psi=20250904172534993-113200301321-0920486271", + "host": "push2.eastmoney.com:push2.eastmoney.com", + "referer": "https://quote.eastmoney.com/center/gridlist.html", + "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"", + "sec-ch-ua-mobile": "?0:?0", + "sec-ch-ua-platform": "\"Windows\":\"Windows\"", + "sec-fetch-dest": "script:script", + "sec-fetch-mode": "no-cors:no-cors", + "sec-fetch-site": "same-site:same-site", + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" + } logger.info("东方财富美股实时股价数据采集器初始化完成") def _ensure_table_exists(self) -> bool: diff --git a/src/valuation_analysis/stock_price_collector.py b/src/valuation_analysis/stock_price_collector.py index 88a4808..8d9ab2d 100644 --- a/src/valuation_analysis/stock_price_collector.py +++ b/src/valuation_analysis/stock_price_collector.py @@ -94,12 +94,21 @@ class StockPriceCollector: ) self.base_url = "https://push2.eastmoney.com/api/qt/clist/get" self.headers = { - "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", - "Accept": "application/json, text/plain, */*", - "Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8", - "Origin": "https://quote.eastmoney.com", - "Referer": "https://quote.eastmoney.com/", - } + "accept": "*/*:*/*", + "accept-encoding": "gzip, deflate, br, zstd:gzip, deflate, br, zstd", + "accept-language": "zh-CN,zh;q=0.9,en;q=0.8:zh-CN,zh;q=0.9,en;q=0.8", + "connection": "keep-alive:keep-alive", + "cookie": "qgqp_b_id=3d1376c8b3609b85ddd613ff70797b21; st_nvi=OkigGRrjz_ZnTtL_7eE4-4595; nid=0820fd3f15fe4f7c0164f8a7eff85c5f; nid_create_time=1754027308372; gvi=p9WxDMFjnfkCUiL8CQ3ex015a; gvi_create_time=1754027308372; fullscreengg=1; fullscreengg2=1; st_si=11531712238902; st_asi=delete; st_pvi=49494569999152; st_sp=2025-05-12%2009%3A11%3A41; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink; st_sn=11; st_psi=20250904172534993-113200301321-0920486271:qgqp_b_id=3d1376c8b3609b85ddd613ff70797b21; st_nvi=OkigGRrjz_ZnTtL_7eE4-4595; nid=0820fd3f15fe4f7c0164f8a7eff85c5f; nid_create_time=1754027308372; gvi=p9WxDMFjnfkCUiL8CQ3ex015a; gvi_create_time=1754027308372; fullscreengg=1; fullscreengg2=1; st_si=11531712238902; st_asi=delete; st_pvi=49494569999152; st_sp=2025-05-12%2009%3A11%3A41; st_inirUrl=https%3A%2F%2Fwww.baidu.com%2Flink; st_sn=11; st_psi=20250904172534993-113200301321-0920486271", + "host": "push2.eastmoney.com:push2.eastmoney.com", + "referer": "https://quote.eastmoney.com/center/gridlist.html", + "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"", + "sec-ch-ua-mobile": "?0:?0", + "sec-ch-ua-platform": "\"Windows\":\"Windows\"", + "sec-fetch-dest": "script:script", + "sec-fetch-mode": "no-cors:no-cors", + "sec-fetch-site": "same-site:same-site", + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" + } logger.info("东方财富实时股价数据采集器初始化完成") def _ensure_table_exists(self) -> bool: