受欢迎的博客标签

c# 用Microsoft.Playwright爬取同花顺(10jqka)主营业务,经营范围

Published

 

p

主营业务,经营范围

menu path:

经营分析


https://basic.10jqka.com.cn/astockpc/astockmain/index.html#/operate?code=000002&marketid=33

https://basic.10jqka.com.cn/astockpc/astockmain/index.html#/operate?code=601021&marketid=17   已有股票代码表,用Microsoft.Playwright爬取,C# HtmlAgilityPack 解析,以document 存入mongodb,完整源代码.

分析

同花顺(10jqka)的页面是典型的 SPA(单页面应用),HTML + JS 混合(部分数据是接口返回),数据通过异步接口加载并渲染,因此使用 Playwright 模拟浏览器行为。

完整解决方案

包含数据模型定义、Playwright 爬取、HtmlAgilityPack 解析以及 MongoDB 存储的完整 C# 代码。

 

1.NuGet 包:

Microsoft.Playwright
HtmlAgilityPack
MongoDB.Driver

 

2.爬取链接url - 主营业务 / 经营分析

https://basic.10jqka.com.cn/astockpc/astockmain/index.html#/operate?code=000002&marketid=33

https://basic.10jqka.com.cn/astockpc/astockmain/index.html#/operate?code=601021&marketid=17

参数说明:

code=000002 股票代码
marketid=33(深市)/ 17(沪市)