Collect real public opinion data on a large scale from mainstream Chinese platforms, analyze the expression style and sentiment tendency of comments one by one, and finally generate an HTML report.
Prerequisite: Confirm the environment
opencli list -f json | grep -E "weibo|zhihu|bilibili|xiaohongshu|douyin"
The above 5 platforms must be available. If any are missing, inform the user to skip that platform. All are cookie strategy, requiring Chrome login + OpenCLI extension.
Workflow
Step 1: Event modeling
Confirm with the user (if missing, proactively ask):
- Event keywords: 1-3 core search terms and 2-3 variants/aliases
- Event type(determines which template's CSS theme color and dedicated components to use):
product→ Blue · Feature dimension componentcrisis→ Red · Timeline/source tracing componentcampaign→ Orange · KOL table componentperson→ Purple · Image radar/fan-anti split-column componentcompetitive→ Green · Two-column comparison/VS/preference matrix component
- Time range: defaults to the last 7 days
- Monitored entities: the products/brands/person names involved
Step 2: Large-scale parallel collection
Target: total of 3,000+ items, with at least 500 per platform. Expansion methods:
- Multi-keyword parallel search: issue the main term + variants simultaneously
- Pagination/increase limit: for each search
--limit 50(or the maximum allowed by that platform) - Deep dive into high-engagement content: collect comments for posts with high interaction in search results:
opencli weibo comments "<url>" --limit 100 -f json opencli bilibili comments "<url>" --limit 100 -f json opencli xiaohongshu comments "<url>" --limit 100 -f json - Deep dive into Zhihu questions:
opencli zhihu question <id> --limit 20 -f json
Parallel collection: the search commands for the 5 platforms do not depend on each other; issue them all in the same batch.
Detailed command reference:references/platform-guide.md
Important: each piece of data retains the url field, used to generate hyperlinks in the report.
Step 3: Data cleaning and analysis
3.1 Deduplication and filtering
- Deduplicate by
url/iddeduplicate - Filter out empty content, meaningless content with fewer than 3 characters, and pure emojis
- Flag the same account for spamming
3.2 LLM item-by-item analysis
Annotate each comment with three-dimensional labels. For detailed methodology, see references/analysis-guide.md。
Three-dimensional labels:
| Dimension | Value | Meaning |
|---|---|---|
sentiment |
positive / negative / neutral |
Sentiment polarity |
expression |
literal / ironic / abstract / trolling |
Expression style |
topics |
String array, e.g. ["价格","续航"] |
Topic attribution |
expression judgment criteria:
literal— the literal meaning is the true attitudeironic— sarcasm/irony, positive wording + negative contextabstract— abstract meme/online slang (e.g. "dian" "beng" "le" "nanbeng" "yyds")trolling— role-playing bait, disguising a stance to provoke conflict
Analysis Prompt template: see references/analysis-guide.md. Each batch of 20-30 items, with context attached.
3.3 Aggregate statistics
- Proportion distribution of each sentiment/expression style/topic
- The above metrics broken down by platform
- Time distribution (if timestamps are available)
- Top N high-frequency keywords
Step 4: Build the report
Core principle: The template only provides CSS styles and ECharts helper functions, and does not preset any content structure. You decide which Sections the report includes, in what order, and with which charts based on the actual data and analysis results.
4.1 Choose a template
Read the corresponding HTML template file according to the event type:
product→templates/product.htmlcrisis→templates/crisis.htmlcampaign→templates/campaign.htmlperson→templates/person.htmlcompetitive→templates/competitive.html
4.2 Reference for CSS component class names in the template
The following class names can be used in all 5 templates. The differences between templates lie only in :root{} the CSS variables (--accent、--accent-light、--accent-dark the three colors differ), and each template has a small number of dedicated components.
Layout container:
.container— content area container (max-width 1200px centered).section— white card container (rounded corners + shadow).section-title— section title (with a themed-color underline at the bottom).section-desc— section description text (small gray text).col-2— equal-width two-column grid layout.divider— divider
Overview card:
.summary-row— responsive card grid (automatic wrapping).summary-card— single overview card.summary-card .s-label— card label.summary-card .s-value— card value (32px bold).summary-card .s-sub— card supplementary note
Chart:
.chart-row— responsive chart grid (two-column automatic wrapping).chart-box— chart container (380px high).chart-full— full-width chart container (420px high, spanning all columns)- Each chart needs a unique
id, initialized withinitChart('id', option)Initialize
Comment display:
.comment-list— comment list container (flex column, 16px spacing).comment-item— single comment card.comment-header— comment header (author + platform + interaction data).comment-author— author name.comment-stats— interaction data (likes/replies).comment-text— comment body.comment-tags— tag row (flex wrap).comment-link— view original link (<a>tag,target="_blank")
Platform badge:
.platform-badge+.weibo/.zhihu/.bilibili/.xiaohongshu/.douyin
Tag:
.tag+.positive/.negative/.neutral(sentiment).tag+.literal/.ironic/.abstract/.trolling(expression style).tag+.topic(topic attribution)
Strategy recommendations:
.strategy-box— emphasized box with left border.strategy-box ul/.strategy-box ol/.strategy-box li
General:
.data-table— general data table (with hover highlight).callout+.info/.warn/.success— tooltip.text-accent/.text-positive/.text-negative/.text-secondary— text color.text-sm/.text-lg/.text-xl/.text-bold— text size/weight.muted— gray text
Template-specific components:
| Template | Dedicated CSS class |
|---|---|
| product | .feature-grid .feature-card .feature-bar .f-pos .f-neg .f-stats |
| crisis | .alert-bar .crisis-level .timeline .timeline-item .timeline-item.key .timeline-time .timeline-title .timeline-desc .source-tree .source-node .phase-row .phase-dot.active|past|future .comment-item.urgent |
| campaign | .kol-table |
| person | .person-profile .p-meta .p-name .p-desc .fb-split .fb-card.fans|black|mid .fb-label .fb-value .fb-sub .timeline .timeline-item .timeline-item.key .timeline-time .timeline-title .timeline-desc |
| competitive | .vs-header .vs-entity.a|b .vs-divider .e-name .e-vol .compare-grid .compare-card.a|b .matrix-table .matrix-win-a|b|tie .comment-item.entity-a|b .tag.entity-a|b .text-entity-a|b |
4.3 Build process
- Read the selected template HTML file
- Modify
<title>tag - Modify
<header>the title, date, and event badge in - In
<div class="container">within the comment-marked area of, build the report content HTML from scratch - At the bottom of the
<script>tag, useinitChart()to initialize each chart - Write to file:
report-{事件简称}-{日期}.html
The report structure and content are entirely up to you based on the data. You can freely combine CSS class names to build any layout and fill in any content you derive from analyzing the data.
4.4 Comment display specifications
Each displayed comment must include:
- Platform logo (e.g.,
<span class="platform-badge weibo">微博</span>) - Anonymized author name (first character ++ last character, e.g., "ZhangSan")
- Comment text (preserve the original text including emojis)
- Analysis tags: sentiment tag + expression style tag + topic tag
- Clickable hyperlink to jump to the original text:
<a class="comment-link" href="原始url" target="_blank">查看原文 →</a> - Interaction data (if available): number of likes, number of replies
4.5 ECharts Usage
// initChart 已在模板中全局注册,接收 (domId, echartsOption)
initChart('chart-my-pie', {
tooltip: { trigger: 'item' },
series: [{ type: 'pie', data: [...] }]
});
// 图表会自动响应窗口resize
Chart type suggestions(choose based on the data):
- Sentiment distribution → pie chart/donut chart
- Time trend → line chart (smooth: true)
- Platform/topic comparison → bar chart (bar)
- Multidimensional comparison → radar chart (radar)
- Relationship/matrix → heatmap (heatmap)
- KOL effect → scatter plot (scatter)
Step 5: Output
- Write HTML to
report-{事件简称}-{日期}.html - Inform the user of the file path
- Verbally state the key findings (3-5 sentence summary)
Reference files
| File | When to read |
|---|---|
references/platform-guide.md |
Before starting collection in Step 2 |
references/analysis-guide.md |
Before starting comment analysis in Step 3 |
templates/product.html |
When the event type is product |
templates/crisis.html |
When the event type is crisis |
templates/campaign.html |
When the event type is campaign |
templates/person.html |
When the event type is person |
templates/competitive.html |
When the event type is competitive |
Notes
- Do not hardcode the platform command list; use
opencli list -f jsonto confirm - Prioritize parallel collection; searches on different platforms do not depend on each other
- Comment analysis is the core value; do not just do statistics
- Hyperlinks must be valid and clickable to jump to the original text
- Anonymize author names
- When unsure whether a comment is ironic trolling, label it as
ironic(conservative labeling) - When the collected volume is insufficient, do not fabricate data; honestly inform the user and give the reason