37 lines
1.0 KiB
Python
37 lines
1.0 KiB
Python
"""
|
|
测试巨潮爬虫 - 完整测试
|
|
"""
|
|
import asyncio
|
|
import sys
|
|
sys.path.insert(0, ".")
|
|
|
|
from app.services.cninfo_crawler import cninfo_service
|
|
|
|
async def test_crawler():
|
|
print("=" * 60)
|
|
print("测试新版巨潮资讯网API - 正式测试")
|
|
print("=" * 60)
|
|
|
|
# 测试博士眼镜 300622 (深市)
|
|
stock_code = "300622"
|
|
print(f"\n📊 正在查询 {stock_code} (博士眼镜) 的年报/半年报...")
|
|
|
|
reports = await cninfo_service.search_reports(stock_code)
|
|
|
|
if reports:
|
|
print(f"\n✅ 成功获取到 {len(reports)} 份有效报告:")
|
|
for i, r in enumerate(reports, 1):
|
|
print(f" {i}. [{r['report_year']}年{r['report_period']}] {r['title'][:40]}...")
|
|
|
|
# 显示下载链接示例
|
|
if reports[0].get('pdf_url'):
|
|
print(f"\n📥 示例下载链接:")
|
|
print(f" {reports[0]['pdf_url']}")
|
|
else:
|
|
print("\n❌ 未获取到任何报告")
|
|
|
|
print("\n" + "=" * 60)
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_crawler())
|