fix: restore 0.1s sleep between Eastmoney HK requests (anti-scraping)
This commit is contained in:
@@ -155,6 +155,7 @@ def fetch_hk_eastmoney(codes):
|
|||||||
change_pct = str(item.get("f170", "0"))
|
change_pct = str(item.get("f170", "0"))
|
||||||
if price > 0:
|
if price > 0:
|
||||||
results[code] = (price, change, change_pct)
|
results[code] = (price, change, change_pct)
|
||||||
|
time.sleep(0.1) # 防止触发东财反爬(逐股查询,不支持批量)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"⚠️ 东方财富 {code} 拉取失败: {e}", file=sys.stderr)
|
print(f"⚠️ 东方财富 {code} 拉取失败: {e}", file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user