investor-sentiment

Investor Sentiment Analysis: Scrapes public text from Eastmoney forums, Taoguba, Sina Stock Forum, iFinD/Flush Stock Forum, Sina Finance, Xueqiu, and iFinD/Flush Finance; scores each text from -1 to +1 using a local Chinese financial sentiment lexicon; aggregates metrics such as net sentiment, controversy, extreme-share, and discussion heat. Outputs JSON, Markdown, or single-file HTML reports (embedded SVG, offline viewable). Accepts cookies to access sources requiring login. Intended for retail investor sentiment, public-opinion, and single-stock discussion analysis.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "investor-sentiment" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9b74eb1e021da8a11b79478fc3f82ecded891648b0e469bed78866f8b5247b1b. Verify the upstream source and version against https://skillhub.cn/skills/user_c38d76f4/a-investor-sentiment before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Investor Sentiment Analysis: Scrapes public text from Eastmoney forums, Taoguba, Sina Stock Forum, iFinD/Flush Stock Forum, Sina Finance, Xueqiu, and iFinD/Flush Finance; scores each text from -1 to +1 using a local Chinese financial sentiment lexicon; aggregates metrics such as net sentiment, controversy, extreme-share, and discussion heat. Outputs JSON, Markdown, or single-file HTML reports (embedded SVG, offline viewable). Accepts cookies to access sources requiring login. Intended for retail investor sentiment, public-opinion, and single-stock discussion analysis.

0 Downloads

Introduction source: third_party · user_c38d76f4 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
pip install requests beautifulsoup4 lxml
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: investor-sentiment
description: 股民情绪分析 / 舆情情绪分析 / 散户情绪打分。从东方财富股吧、淘股吧、新浪股吧、同花顺股吧、新浪财经、雪球、同花顺财经抓取公开文本,用本地中文金融情感词典给每条文本打 -1~+1 的情绪分,聚合出情绪净值、争议度、极端占比、讨论热度等指标,输出 JSON / Markdown / 单文件 HTML 报告(内联 SVG,离线可看)。支持传 Cookie 打通雪球、同花顺股吧等需要登录态的源。当用户提到股民情绪、散户情绪、舆情、市场情绪、雪球热帖、股吧热度、个股讨论数据分析时使用。
version: 1.0.0
tags: [股民情绪, 散户情绪, 舆情分析, 股票, 情绪打分, 股吧, 雪球]

股民情绪分析

抓文本 → 打分 → 聚合 → 出报告。全部本地完成:不调大模型、不调任何云 NLP API、 不依赖 CDN —— 断网也能打开生成的 HTML。

快速开始

# 1) 依赖(一次性)
pip install requests beautifulsoup4 lxml

# 2) Windows 强烈建议先执行,否则终端中文会乱码
set PYTHONUTF8=1

# 3) 跑:一只票,默认「真散户」三源:东财股吧 + 淘股吧 + 新浪股吧
python scripts/senti.py --code 600519 --pages 2 --outdir out

# 多只票
python scripts/senti.py --code 600519,000858,300750 --pages 2

# 只要某个源
python scripts/senti.py --code 600519 --sources sina_guba --pages 3 --body-limit 15

# 不开票号的关键词模式(走新浪7x24 + 同花顺新闻,必须给关键词过滤)
python scripts/senti.py --keyword 人工智能 --sources sina,ths --pages 2

# 所有源都上(雪球 / 同花顺股吧都要 cookie)
python scripts/senti.py --code 600519 --all-sources --cookie "..."

# 雪球(需登录 cookie,走 App 侧域名 api.xueqiu.com;主域被 WAF 拦)
python scripts/senti.py --code 600519 --sources eastmoney,tgb,sina_guba,xueqiu \
    --cookie-file secrets/xq_cookie.txt --pages 3

# Cookie 放文件里更安全(一行一条,支持 # 注释)

# 同花顺股吧(需登录 cookie;⚠ 它的散户帖停更在 2020 年,只当历史语料用)
python scripts/senti.py --code 600519 --sources ths_guba --cookie-file secrets/ths_cookie.txt

产出落 --outdir:

文件 内容
{code}_{名称}_{时间}.json 全量:每条文本的 score / hits / URL + 指标 + 各源状态
同名 .html 单文件报告(指标卡 / 情绪构成(整体)/ 分平台情绪构成 / 小时走势 / 高频情绪词 / 代表性原帖)

终端同时打印一份 Markdown 摘要。

参数

参数 默认 说明
--code — 股票代码,逗号分隔;不给则需 --keyword
--keyword — 关键词,用于新浪7x24 / 同花顺新闻过滤
--sources 依场景 eastmoney, tgb, sina_guba, sina_stock, sina, xueqiu, ths, ths_guba
--all-sources off 八个源都跑
--pages 2 每源翻几页
--delay 1.0 请求间隔秒数,别改成 0(会被封 IP)
--workers 3 并发源数;总耗时 ≈ 最慢的那个源
--thr 0.2 正/负判定阈值
--timeout 12 单请求超时
--body-limit / --no-body 10 / off 正文补齐条数(东财 + 新浪股吧共用;--no-body 只跑标题,快很多)
--cookie $SENTI_COOKIE 通用 Cookie(k=v; k2=v2),喂给需要登录的源(雪球等)
--cookie-file — 从文件读 Cookie(整行一条,支持 # 注释),比命令行安全
--xq-cookie $XQ_COOKIE 雪球 Cookie(等价 --cookie,保留兼容)
--xq-sort alpha 雪球讨论排序:alpha=热门 / time=最新 / recommend=推荐
--xq-comments 3 雪球再补抓前 N 个热帖底下的评论(0 = 不抓)
--ths-cookie $THS_COOKIE 同花顺 Cookie;ths_guba 源必填,不填则回退到通用 --cookie
--outdir sentiment_out 输出目录

源怎么选

源 要不要登录 拿到什么 什么时候用
eastmoney 免 帖子标题 + 正文 + 阅读/评论数 默认主力,样本量最大(80 条/页)
tgb 免 主帖/跟帖 + 作者 + 时间 想要游资/实盘视角时用
sina_guba 免 散户主帖 + 正文 + 回复 默认三源之一;比东财小众但更"人话"(60 条/页)
sina_stock 免 个股新闻标题 想看媒体口径时用(不是散户发言)
sina 免 7x24 全球快讯 全市场氛围,必须配 --keyword
xueqiu 要 Cookie 雪球个股讨论(20 条/页,可翻页)+ 热帖评论 走 App 侧域名 api.xueqiu.com(主域被 WAF 盖死,别碰);用 --cookie-file 传登录态,可当第 4 源
ths 免 同花顺财经新闻 全市场,必须配 --keyword
ths_guba 要 Cookie 同花顺股吧散户帖(标题 + 摘要) ⚠️ 数据停更在 2020 年 1~4 月,只当历史语料;接口实测 t.10jqka.com.cn 的 /newcircle/post/getPostList/

工作流

  1. 先确定目标:有代码就 --code(默认三源),没有就 --keyword(只能走 sina/ths 两个全市场源)。
  2. 跑 CLI,拿到 Markdown 摘要先看「数据源状态」—— 有源报错先看是全失败还是个别失败, 别急着信指标。n < 15 时结论自带"样本仅 N 条"前缀,这时要么加 --pages,要么换票/换关键词。
  3. 出报告:.html 直接双击打开。要看「这条凭什么被判成负面」就翻 .json 里的 hits 字段(例如 [["跌停", -3.0], ["主力出货", -2.5]]),逐条对得上是哪几个词顶起来的。

改词表 / 调权重:编辑 scripts/lexicon.py(唯一的词表来源),然后跑自带的回归用例 python scripts/selftest.py(18 条覆盖否定/转折/程度/表情/数值/广告的断言), 全绿再上生产线。发现误判就把那条补进 selftest,别口头说"改好了"。

需要时才读的文档

  • references/sources.md —— 各平台接口的实测档案(2026-10-11 首测 / 10-12 修订,均为真机验证): 具体 URL、解析选择器、每页条数、哪些接口失效或需要登录(东财 api/getData 网关、同花顺新股吧 要登录态、雪球要走 api.xueqiu.com 而非主域)、各自的踩坑点。接口报错 / 想新增源时读它。
  • references/indicators.md —— 档次/口径的唯一来源:打分链条的每一步常量、 聚合公式(情绪净值 / 争议度 / 极端占比 / 热度)、颜色口径、已知局限。 用户质疑"这个 0.8 分怎么来的"时读它。

常见坑(血泪版,别重蹈覆辙)

  • 别指望拿到东财的评论正文:它的 /api/getData 网关匿名请求一律返回同一个兜底包, 试过 env=1/2、带 cookie、path 放 query 都没用 → 只用 SSR 的标题+正文,评论数当权重。 (想要评论正文可以走新浪股吧,那个能拿到。)
  • &nbsp;{0,2} 是错的:量词只作用在分号上,写重复实体要用 (?:&nbsp;|\s)*(新浪页面已踩)。
  • 新浪 7x24 的 creator 可能是字符串,get("nick") 之前要 isinstance 判断(已修,别删)。
  • 新浪股吧两个坑:页面是 GBK(写 utf-8 会让正文/昵称乱码);回复项标签是 <article> 不是 div, 要用 [class*=reply-post](div.reply-post 永远匹配 0 个)。
  • 雪球必须走 App 侧域名 api.xueqiu.com:主域 xueqiu.com 被阿里云 WAF 盖死 —— 连 /S/SH600519 页面本体都返回 _waf_bd8ce2ce37 challenge 页(requests / curl / 无头 Chrome 全过不去,硬撞还会被雪球自己的风控页封几小时,页面上明写着针对 AI Agent 抓取工具)。 能用的只有 api.xueqiu.com(同一个后端,没挂 WAF),且必须带登录 Cookie —— 匿名时它照样返回 HTTP 200,但 list 是空数组,很容易被误判成"接口坏了"。 详见 references/sources.md 第 4 节。
  • 同花顺股吧:老域名死了,新接口能通但数据停更。老 bbs.10jqka.com.cn 是 2020 静态占位页; 新接口 t.10jqka.com.cn/newcircle/post/getPostList/?stockcode={code}&page={N}&type=1 用登录 Cookie 可以打通(抓取器 fetch_ths_guba),但散户帖最后一篇停在 2020-01~04,只能当历史语料。 两个坑:① 参数名必须是 stockcode,写成 code 会返回 -10001 无权限访问,很容易被误判成 「路径对、只差鉴权」;② 详情页 pid_{pid}.shtml 是 404,只有标题 + 摘要。详见 references/sources.md 第 5 节。
  • 本机没有可用的无头浏览器:agent-browser 的 Chromium 下载 198MB 超时失败(重试 3 次), Edge --headless --dump-dom/--screenshot 在本机零输出。别把浏览器当兜底:优先找 HTTP 接口, 接口要登录就请用户给 Cookie(--cookie-file)。
  • 夜间/周末跑出来的样本偏向国际宏观(尤其新浪),看个股情绪请在交易时段内抓。
  • 输出是「文本统计」,仅供个人研究,不构成投资建议;对外发布前自己核对各站条款。

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value82/100

Highlights

  • 解决股民情绪量化分析刚需,支持多平台抓取与本地情感打分
  • 输出结构化报告(JSON/HTML),满足离线查看与深度分析需求
Trigger Precision92/100

Highlights

  • 触发词覆盖完整:股民情绪、散户情绪、舆情、雪球热帖等关键词明确
Structure and Standards94/100

Areas to improve

  • 缺少 When to Use 显式章节 Reported severity: Minor

    虽内容已覆盖使用场景,但未设独立章节

    Recommendation: 可补充显式 When to Use 章节提升可读性

Highlights

  • CLI示例完整,参数说明清晰,工作流指导性强
Execution Reliability88/100

Areas to improve

  • 未提及代理支持 Reported severity: Minor

    多源抓取场景下可能需代理规避IP封禁

    Recommendation: 可补充代理参数说明

Highlights

  • 覆盖主要异常处理:超时、编码、WAF规避、登录态管理
Evidence Verifiability (mean of the first four)89/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 17

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

pip install requests beautifulsoup4 lxml

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.