Preface¶
The built-in web_fetch tool in DeepSeek Harness often fails when handling WeChat official account articles. This is because WeChat’s site returns an environment check page, the body text is wrapped in extensive inline styles and nested containers, and images utilize lazy loading. The dsh-weixin-reader plugin aims to resolve these pain points by extracting WeChat article body text into clean Markdown format and providing a specialized tool for model invocation.
Core Features¶
This plugin registers a tool named weixin_read within the Harness for direct invocation by the model.
Tool Parameters
| Parameter | Type | Required | Description |
| :— | :— | :— | :— |
| url | string | Yes | WeChat article link, e.g., https://mp.weixin.qq.com/s/xxxxxxxx |
| maxChars | integer | No | Maximum character count for the body text; content exceeding this limit will be truncated and flagged |
| saveToFile | boolean | No | Whether to save the full text to a workspace file |
Return Values
The tool returns a standard result containing the following fields:
- title: Title
- author: Author
- publishedAt: Publication time
- sourceUrl: Source link
- wordCount: Word count
- imageCount: Number of images
- markdown: Parsed Markdown content
- truncated: Whether the content was truncated
- savedTo: Save path (if enabled)
- bodyChars: Actual character count of the body text
Additionally, the plugin registers a system prompt segment instructing the model to prioritize weixin_read over web_fetch when encountering WeChat official account articles.
Installation and Activation¶
Before installation, please ensure that the current DeepSeek Harness process has network access capabilities.
dsh plugin --profile web add github:jack1545/dsh-weixin-reader
After installation, restart the Harness process to load the plugin layer. You can verify if the plugin is active by running the following command (checking if the configuration includes the dsh-weixin-reader layer):
dsh --profile web --dump-config
To uninstall:
dsh plugin --profile web remove dsh-weixin-reader
Configuration¶
The plugin’s configuration items are located in the config block of cordis.patch.yml, supporting overrides of default values in specific profile configurations.
| Config Item | Default Value | Description |
|---|---|---|
timeoutMs |
30000 | Request timeout duration (milliseconds) |
maxChars |
60000 | Maximum character limit for body text |
saveToFile |
false | Whether to save the full text to a file by default |
saveDir |
”“ | Save directory; if empty string, saves to <workspace>/weixin-articles/ |
systemPromptOrder |
10120 | Insertion order of the system prompt segment |
userAgent |
”“ | Custom User-Agent; if left blank, uses default desktop browser UA |
Technical Details & Limitations¶
Dependencies & Sandbox Restrictions
- Zero External Dependencies: The plugin does not引入 any third-party packages, utilizing only Node.js built-in modules and the ctx provided by the Harness.
- Child Processes Disabled: Since the Harness file sandbox restricts pipe read/write operations for Node child processes (both execFileSync and spawn report EPERM errors), the plugin cannot use external fetch tools or child processes. It uses the host environment’s fetch and inherits the current process’s proxy settings.
Functional Boundaries
- mp.weixin.qq.com Only: The plugin explicitly rejects other domains and cannot be used as a general-purpose scraping tool.
- Explicit Error Handling: When encountering environment check pages, deleted or restricted articles, or unrecognized page structures, it throws errors directly rather than silently returning empty content.
- Markdown Output: Returns parsed Markdown rather than raw HTML. Images are preserved as Markdown syntax and are not downloaded. Complex rich text layouts (such as custom cards) are downgraded to plain text.
- No Batch Support: The plugin only supports single article scraping. Please comply with WeChat platform terms; request frequency should be kept low.
Typical Usage¶
1. Invocation within Harness
Directly invoke the weixin_read tool in conversation or configuration:
Please use the weixin_read tool to fetch the body text of the following link and summarize it:
https://mp.weixin.qq.com/s/xxxxxxxx
2. Local Debugging
The plugin includes a standalone parser lib/parser.js that can run without relying on the Harness:
import { fetchArticle, formatArticle } from './lib/parser.js';
const article = await fetchArticle('https://mp.weixin.qq.com/s/xxxxxxxx');
console.log(article.title, article.author, article.wordCount);
console.log(formatArticle(article));
Conclusion¶
dsh-weixin-reader provides specialized parsing capabilities for WeChat official account articles for DeepSeek Harness, solving compatibility issues faced by general scraping tools in the WeChat environment. Its design adheres to the Harness plugin ecosystem specifications, supporting zero-dependency operation and granular configuration. For more details and source code, please visit: GitHub Repository | Community Directory.