How to Feed Real-Time Chinese Social Intelligence (Bilibili & Weibo) and Clean PDF Markdown into Claude MCP & n8n Workflows
If you build AI agents, market research pipelines, or RAG knowledge bases, two data ingestion bottlenecks show up over and over again: Monitoring China's tech & consumer narrative in English-friendly JSON. Most global
If you build AI agents, market research pipelines, or RAG knowledge bases, two data ingestion bottlenecks show up over and over again:
- Monitoring China's tech & consumer narrative in English-friendly JSON. Most global teams either ignore Weibo and Bilibili entirely or rely on brittle ad-hoc scripts that choke on noisy HTML tags, truncated long posts, inconsistent timestamps, and messy encodings.
-
Overpaying to parse digital PDFs for RAG. Roughly 80β90% of ArXiv papers, whitepapers, API specs, and public filings already have an embedded native text layerβyet pipelines routinely send them straight to heavy visual OCR tools at
$3β$5+per 1,000 docs (or per-page pricing) and still get billed when a batch hits 404 links or broken files.
In this guide, I'll walk through a production-ready, low-cost setup using three lightweight Apify Actors that plug straight into Claude Desktop / Cursor MCP, n8n, and Python / LangChainβall testable within Apify's $5/month free tier.
1. The Three Building Blocks (Exact Specs & Pricing)
Every Actor below exposes a synchronous REST endpoint (run-sync-get-dataset-items) returning clean, normalized JSON, and works out of the box with Apify's official MCP Server (mcp.apify.com):
| Actor | Best For | Key Output Fields | Transparent Pay-Per-Event Pricing |
|---|---|---|---|
alias_md5/weibo-scraper |
Real-time Weibo Hot Search Top 50+, keyword posts (auto-expanded long text), user timelines, post details (with optional free top-5 comments), and deep paginated comments (100β1,000/post) |
topicTitle, rank, heatScore, category, text (HTML stripped), hashtags, ipLocation, createdAtIso, likeCount, commentCount, author
|
Hot Search / Posts: $1.50 (Free) β $0.75 (Gold/Enterprise) per 1k; Details / Comments: $2.00 β $1.00 per 1k. $0 on failures/deleted posts.
|
alias_md5/bilibili-scraper |
Keyword video search, full engagement metrics, paginated comments (up to 2,000/video), timestamped danmaku (bullet comments), trending rankings, and UPδΈ» creator profiles |
bvid, title (cleaned), viewCount, danmakuCount, likeCount, favoriteCount, videoTimestampSeconds, text, publishedAtIso, creator
|
Search / Trending: $1.00 β $0.50 per 1k; Danmaku: $0.05 β $0.02 per 1k; Comments: $1.50 β $0.70 per 1k. $0 on errors/empty runs.
|
alias_md5/pdf-markdown-extractor |
High-speed batch conversion of digital native-text PDFs (ArXiv, filings, manuals, reports) into heading-aware, reflowed Markdown + per-page arrays |
sourceUrl, title, author, pageCount, wordCount, markdown, pages[] + RUN_SUMMARY audit report |
$1.00 (Free) β $0.50 (Enterprise) per 1,000 PDFs. 404s, non-PDF HTML, encrypted, oversized, and scanned image-only PDFs (no_text_layer) cost $0. |
Cost sanity check on the $5/month free tier:
- Pulling 50 Weibo Hot Search topics + 20 Bilibili tech videos + 1,000 danmaku every single day costs
$0.145/dayβyour free$5monthly credit covers 34 days of daily intelligence.- Extracting 1,000 digital ArXiv/research PDFs costs
$1.00on the free planβmeaning$5covers 5,000 PDFs.
2. Plug Straight into Claude Desktop or Cursor via MCP (60 Seconds)
You don't need to write a custom MCP wrapper. Apify's official MCP server exposes your selected Actors directly as structured tools with their full input schemas.
Option A: Remote Streamable HTTP MCP
For clients that support remote MCP endpoints:
{
"mcpServers": {
"apify-intel-and-pdf": {
"url": "https://mcp.apify.com/?actors=alias_md5/weibo-scraper,alias_md5/bilibili-scraper,alias_md5/pdf-markdown-extractor",
"headers": {
"Authorization": "Bearer YOUR_APIFY_API_TOKEN"
}
}
}
}
Option B: Local Stdio Bridge (Claude Desktop / Cursor)
Add this snippet to claude_desktop_config.json or .cursor/mcp.json:
{
"mcpServers": {
"apify-intel-and-pdf": {
"command": "npx",
"args": [
"-y",
"@apify/actors-mcp-server",
"--actors",
"alias_md5/weibo-scraper,alias_md5/bilibili-scraper,alias_md5/pdf-markdown-extractor"
],
"env": {
"APIFY_TOKEN": "YOUR_APIFY_API_TOKEN"
}
}
}
}
Once connected, you can prompt Claude or Cursor in plain Englishβeven when the underlying discussion is in Chinese:
- Cross-border tech & brand radar: "Pull the top 30 Weibo Hot Search topics right now, filter for AI, semiconductors, and EVs, and summarize them in English with heat scores and why each matters."
-
Product sentiment from Bilibili danmaku: "Search Bilibili for 'NVIDIA' sorted by danmaku count (
searchOrder: 'dm'), take the top video's BVID, extract 300 danmaku comments, and cluster viewer reactions in English with timestamp highlights." -
Instant multi-paper synthesis: "Convert
https://arxiv.org/pdf/1706.03762andhttps://arxiv.org/pdf/2005.11401(pages 1β5,outputFormat: 'markdown',shouldIncludePages: true) and build a side-by-side comparison table of their architectures and reported metrics."
3. Automating Daily Digests & RAG Ingestion in n8n
You can run all three Actors inside n8n using only built-in core nodes (Schedule Trigger, HTTP Request, Code, IF)βno community packages required.
Pattern A: Daily Weibo Hot Search β LLM Briefing β Slack
-
Schedule Trigger: Cron
0 9 * * *(set workflow timezone as needed). -
HTTP Request (
POST):-
URL:
https://api.apify.com/v2/acts/alias_md5~weibo-scraper/run-sync-get-dataset-items?timeout=120&memory=256 -
Header:
Authorization: Bearer {{ $env.APIFY_API_TOKEN }} - JSON Body:
{ "mode": "hot_search", "maxItemsPerQuery": 50, "shouldIncludePinnedTopics": true } -
URL:
Code Node: Sort returned items by
rank, slice the Top 20, and format lines as#rank topicTitle (category) | heatScore.LLM HTTP Request: Send the Top 20 list to
gpt-4o-mini(or DeepSeek / Claude) asking for an English/Chinese executive brief focused on tech, AI, and market moves.Webhook Node: POST the formatted digest to Slack (or adapt the JSON payload for Feishu/DingTalk).
Pattern B: Two-Tier PDF-to-Markdown RAG Pipeline (Cut OCR Spend by 80%+)
A smart RAG pipeline shouldn't pay visual OCR rates for PDFs that already contain digital text. Instead, use alias_md5~pdf-markdown-extractor as your fast, $1/1k primary tier:
-
HTTP Request (
POST) tohttps://api.apify.com/v2/acts/alias_md5~pdf-markdown-extractor/run-sync-get-dataset-items?timeout=180&memory=256:
{
"pdfUrls": [
"https://arxiv.org/pdf/1706.03762",
"https://arxiv.org/pdf/2005.11401"
],
"outputFormat": "markdown",
"shouldIncludePages": true,
"maxFileSizeMegabytes": 50,
"requestTimeoutSeconds": 30
}
-
What comes back: Clean Markdown with headings detected, hard-wrapped lines reflowed, hyphenated line breaks repaired, and a
pages[]array carrying exactpageNumbervalues for grounded RAG citations. -
Zero-charge resilience & OCR escalation: Any 404, HTML page, corrupted file, or image-only scanned PDF is skipped cleanly at
$0without aborting the batch. In Key-Value Storage,RUN_SUMMARY.failedTargetstags image-only scans withfailureCode: "no_text_layer"βso your pipeline only routes that small subset to a heavier OCR engine.
4. Minimal Python Snippet for Batch PDF β RAG Chunks
If you prefer orchestrating ingestion in Python, here's the entire fetch + chunking loop in ~15 lines:
import os
import requests
TOKEN = os.environ["APIFY_API_TOKEN"]
URL = "https://api.apify.com/v2/acts/alias_md5~pdf-markdown-extractor/run-sync-get-dataset-items?timeout=180"
resp = requests.post(
URL,
headers={"Authorization": f"Bearer {TOKEN}"},
json={
"pdfUrls": [
"https://arxiv.org/pdf/1706.03762",
"https://arxiv.org/pdf/2005.11401",
],
"outputFormat": "markdown",
"shouldIncludePages": True,
},
timeout=200,
)
resp.raise_for_status()
for doc in resp.json():
print(f"{doc.get('title')} ({doc['extractedPageCount']} pages, {doc['wordCount']} words)")
for page in doc.get("pages", []):
# Feed page["markdown"] into your chunker + vector store with citation metadata
preview = page["markdown"].replace("\n", " ")[:120]
print(f" p.{page['pageNumber']}: {preview}...")
5. Honest Scope Notes Before You Deploy
-
Weibo pagination: Real-time Hot Search (
50+topics), full post details (auto-expanding long text), and deep multi-page post comments (100β1,000/post) work out of the box. For deeper historical pagination past page 1 insearchoruser_postsmode, Weibo enforces session limitsβyou can optionally pass an optional authenticated session parameter (never logged or written to datasets), or leave it blank and the Actor stops cleanly at the public boundary without throwing errors. -
Bilibili extraction: Keyword search, video details, multi-page comments (up to
2,000/video), timestamped danmaku, trending feeds, and creator profiles all run out of the box. CheckingshouldIncludeCommentsPreview: trueinvideomode attaches the top 5 comments at no extra charge. -
PDF scope:
pdf-markdown-extractoris purpose-built for digital native-text PDFs (not visual OCR). Scanned image-only documents are automatically flagged asno_text_layerand charged$0, making it ideal as a fast front-door parser in a hybrid RAG architecture.
Quick Links (Try Free with $5 Monthly Apify Credit)
- Weibo Scraper:
https://apify.com/alias_md5/weibo-scraper - Bilibili Scraper:
https://apify.com/alias_md5/bilibili-scraper - PDF to Markdown Extractor:
https://apify.com/alias_md5/pdf-markdown-extractor
Disclosure: I am the developer behind these Apify Actors. Happy to answer questions in the comments if you're adapting these patterns for your own MCP or n8n stack!
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.