360 Secure SkillHub
360 安全技能中心

微信公众号文章抓取

提供一个 Python 脚本,模拟浏览器请求抓取微信公众号文章页面,基于 Readability 提取正文并转换为 Markdown,输出含标题、作者、正文和长度的 JSON。需要 Python 3.7+ 及 httpx、readability-lxml。

ranhuang
ranhuang
热度 43.22
最近更新 2026-05-11 17:39:55
分类:效率依赖:代码执行 / 第三方 API应用场景:数据处理 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ye-weixin-web-fetch
Metadata
name
weixin-web-fetch
description
Fetch complete content from WeChat public account articles (mp.weixin.qq.com). Use when extracting content from WeChat official account links, especially when default web fetch gets incomplete content.

WeChat Web Fetch Skill

Features

  • Specialized for WeChat public account articles (mp.weixin.qq.com)
  • Simulates browser request with proper headers to bypass login restrictions for public articles
  • Extracts clean content and converts to Markdown format
  • Based on Readability for accurate content extraction

Requirements

  • Python 3.7+
  • httpx
  • readability-lxml

Usage

{baseDir}/scripts/weixin_fetch.py <url>

Output

Returns JSON with:

  • url: Original URL
  • final_url: Final URL after redirects
  • title: Article title
  • author: Article author (if found)
  • content: Extracted content in Markdown
  • length: Content length
  • truncated: Whether content was truncated

Examples

# Fetch a WeChat article
{baseDir}/scripts/weixin_fetch.py https://mp.weixin.qq.com/s/2o2s3owEDkZziyD0UCeq2w