云计算百科
云计算领域专业知识百科平台

MediaCrawler 小红书爬虫深度调研 七个平台通用采集工具

一、项目概览

MediaCrawler 是一个开源的多自媒体平台爬虫工具,作者 relakkes(B 站:@NanmiCoder),仓库位于 GitHub 的 NanmiCoder/MediaCrawler。支持小红书、抖音、快手、B 站、微博、贴吧、知乎共七个主流平台的公开信息采集。

它的核心思路不是"JS 逆向",而是:

  • 用 Playwright 打开真实浏览器,登录并保存登录态;
  • 利用浏览器上下文执行 JS 表达式生成签名参数(x-s、x-t、x-s-common、x-b3-traceid);
  • 再用 httpx 发请求,把签名塞进请求头里。

这样绕开了对前端加密算法做逆向的需求,技术门槛大幅降低。

二、项目结构速览

仓库下载下来后,目录大致是这样:

main.py # 入口,Typer CLI + asyncio
config/ # 各平台配置
media_platform/ # 各平台实现
xhs/ # 小红书
core.py # XiaoHongShuCrawler 主流程
client.py # HTTP 客户端 + 签名封装
help.py # 签名算法(mrc/CRC32、Base64)
xhs_sign.py # 新版签名函数
playwright_sign.py # 调用 xhshow 库
login.py # 二维码/手机/cookie 登录
field.py # 枚举:排序、NoteType、FeedType
extractor.py # 解析
exception.py # 异常类型
store/ # 存储层(csv/json/jsonl/excel/sqlite/mysql/postgres)
cache/ # 缓存(Redis / 本地)
proxy/ # IP 代理池
cmd_arg/ # CLI 参数解析
api/ # FastAPI 接口(配套 WebUI)
webui/ # Vite 前端
tools/ # 工具函数

三、小红书模块的核心文件

小红书相关的核心实现全在 media_platform/xhs/ 下面,9 个文件:

  • core.py(约 540 行):爬虫主类 XiaoHongShuCrawler,负责启动浏览器、登录、搜索/详情/创作者三条采集路线、并发控制、媒体下载、评论抓取。
  • client.py(约 750 行):XiaoHongShuClient,HTTP 请求封装。核心方法包括:
    • _pre_headers():请求头签名
    • request():httpx 客户端 + 重试 + 异常分类(IP 被封、滑块验证、笔记不存在等)
    • get_note_by_keyword():关键词搜索
    • get_note_by_id() / get_note_by_id_from_html():单帖详情(API 主路径 + HTML 兜底)
    • get_note_all_comments():评论列表(含二级评论)
    • get_creator_info() / get_all_notes_by_creator():创作者主页
  • playwright_sign.py:调用 xhshow 库的 Xhshow 客户端,生成 x-s、x-t、x-s-common、x-b3-traceid 四个签名头。
  • xhs_sign.py / help.py:自研的 CRC32 变体(mrc)+ 自定义 Base64 表 + 编码函数,是 x-s-common 签名的纯 Python 实现。
  • login.py:支持二维码、手机号、Cookie 三种登录方式。
  • field.py:定义 SearchSortType(general / popularity_descending / time_descending)、FeedType、NoteType、Note 结构体。
  • exception.py:DataFetchError、IPBlockError、NoteNotFoundError、PlatformAccessError。

四、三条采集路线

core.py 里 start() 方法根据 config.CRAWLER_TYPE 分发:

  • search —— 关键词搜索
  • detail —— 指定帖子 ID 列表
  • creator —— 指定创作者主页
  • 命令行用 –type 切换,对应配置项 CRAWLER_TYPE。

    五、关键配置项(config/base_config.py + xhs_config.py)

    配置默认值作用
    PLATFORM xhs 目标平台
    LOGIN_TYPE qrcode 登录方式:qrcode / phone / cookie
    KEYWORDS 编程副业,编程兼职 搜索关键词,英文逗号分隔
    CRAWLER_TYPE search search / detail / creator
    CRAWLER_MAX_NOTES_COUNT 15 采集帖子上限
    MAX_CONCURRENCY_NUM 1 并发数
    ENABLE_GET_COMMENTS True 是否抓评论
    ENABLE_GET_SUB_COMMENTS False 是否抓二级评论
    ENABLE_GET_MEIDAS False 是否下载图片/视频
    ENABLE_CDP_MODE True 是否用 CDP 连本地 Chrome
    CDP_CONNECT_EXISTING True 连已有浏览器
    ENABLE_IP_PROXY False 是否启用代理池
    SORT_TYPE popularity_descending 排序:按热度
    SAVE_DATA_OPTION jsonl 存储方式
    START_PAGE 1 起始页
    CRAWLER_MAX_SLEEP_SEC 2 采集间隔

    小红书专有配置在 config/xhs_config.py:

    • XHS_SPECIFIED_NOTE_URL_LIST:指定帖子 URL 列表(必须带 xsec_token)
    • XHS_CREATOR_ID_LIST:指定创作者主页 URL 列表(必须带 xsec_token 和 xsec_source)

    六、签名原理(x-s / x-s-common)

    小红书的 API 反爬主要靠请求头里的签名。MediaCrawler 的处理分两层:

  • x-s 和 x-t:从浏览器上下文里执行 JS 取出来,或者由 xhshow 库生成。
  • x-s-common:纯 Python 实现。核心流程:
    • 构造一个 common 字典,字段有 s0(平台码=3)、x0(b1b1)、x1(版本 4.2.2)、x2(Mac OS)、x3(xhs-pc-web)、x4(4.74.0)、x5(Cookie 里的 a1)、x6(x-t)、x7(x-s)、x8(b1)、x9(mrc(x-t + x-s + b1))、x10(154)、x11(normal)。
    • 对这个 JSON 做 UTF-8 编码、Base64 编码,得到 x-s-common。
    • mrc() 是一个 CRC32 变体,使用 256 项查找表 + 57 位循环处理。

    x-b3-traceid 是一个 16 位的十六进制随机串,纯装饰作用。

    七、CDP 模式(推荐)

    默认配置 ENABLE_CDP_MODE=True、CDP_CONNECT_EXISTING=True。

    这意味着 MediaCrawler 不自己开浏览器,而是连接你已经打开的 Chrome(带 –remote-debugging-port=9222),复用你真实的 Cookie、扩展、浏览历史。反检测能力最强。

    使用步骤:

  • Chrome 地址栏输入 chrome://inspect/#remote-debugging,勾选 “Allow remote debugging”。
  • 显示 Server running at: 127.0.0.1:9222 即就绪。
  • 运行爬虫,Chrome 会弹一个确认框,点"接受"即可。
  • 如果想走标准 Playwright 模式,把 config/base_config.py 里的 ENABLE_CDP_MODE 改为 False,并执行 playwright install 装浏览器驱动。

    八、数据输出

    SAVE_DATA_OPTION 支持 7 种格式:csv / db(MySQL) / json / jsonl / sqlite / excel / postgres。

    数据写入 data/xhs/ 目录(或指定 SAVE_DATA_PATH)。JSONL 格式每一行是一条笔记/评论,方便后续分析。

    支持初始化数据库:uv run main.py –init_db sqlite。

    九、WebUI 可视化

    MediaCrawler 提供了 Web 界面:

    • 后端:uv run uvicorn api.main:app –port 8080 –reload
    • 前端:cd webui && npm install && npm run dev(默认 5173 端口)

    界面功能包括参数配置、运行状态、数据预览导出。

    十、Demo 演示(基于真实源码的示例)

    下面三个示例都是可运行的命令行形式,参数直接来自 cmd_arg/arg.py 的 Typer 定义。

    Demo 1:关键词搜索采集

    cd MediaCrawler
    uv run main.py –platform xhs –lt qrcode –type search –keywords "露营,户外" –crawler_max_notes_count 20 –get_comment true

    说明:

    • 登录方式为扫码(qrcode),首次运行需要打开浏览器扫码
    • 按热度排序(默认 popularity_descending)
    • 采集最多 20 条帖子及其评论
    • 数据存为 JSONL 到 data/xhs/

    Demo 2:指定帖子 ID 采集详情

    前提:帖子的 URL 必须包含 xsec_token,例如:

    https://www.xiaohongshu.com/explore/64b95d01000000000c034587?xsec_token=xxx&xsec_source=pc_cfeed

    命令行:

    uv run main.py –platform xhs –lt cookie –type detail \\
    –cookies "a1=你的a1; b1=你的b1" \\
    –specified_id "https://www.xiaohongshu.com/explore/64b95d01000000000c034587?xsec_token=AB0EFqJv…&xsec_source=pc_cfeed" \\
    –get_comment true

    使用 cookie 登录可以省去扫码。这里把 –lt 设为 cookie,–cookies 传完整 Cookie 字符串即可。

    Demo 3:创作者主页采集

    创作者 URL 需要带 xsec_token 和 xsec_source:

    uv run main.py –platform xhs –lt cookie –type creator \\
    –cookies "a1=你的a1; b1=你的b1" \\
    –creator_id "https://www.xiaohongshu.com/user/profile/5f58bd990000000001003753?xsec_token=ABYVg1evlu…&xsec_source=pc_search" \\
    –crawler_max_notes_count 50

    Demo 4:使用 SQLite 存储并开启二级评论

    uv run main.py –platform xhs –lt qrcode –type search \\
    –keywords "编程副业" \\
    –save_data_option sqlite \\
    –get_comment true \\
    –get_sub_comment true \\
    –max_comments_count_singlenotes 50

    首次运行 SQLite 需要初始化表结构:

    uv run main.py –init_db sqlite

    Demo 5:使用海外版小红书(rednote.com)

    # 在 config/base_config.py 中把 XHS_INTERNATIONAL 改为 True
    uv run main.py –platform xhs –lt cookie –type search –keywords "fashion"

    切换后 API 走 webapi.rednote.com,Cookie 域为 .rednote.com。

    十一、常见踩坑

  • 签名失效:小红书的签名算法会更新,xhshow 库如果跟不上就会 401/403。依赖要求是 xhshow>=0.2.0(修复了 GET 请求的 a3_hash bug)。升级办法:uv pip install –upgrade xhshow。

  • 滑块验证:遇到 code 300011 或 HTTP 461/471 会出现滑块验证,纯文本模型无法完成,需要在真实浏览器里手动过。建议:降采集频率、换代理 IP、检查账号状态。

  • IP 被封:code 300012,触发 IPBlockError,自动重试 3 次后放弃。解决办法:开启代理池(ENABLE_IP_PROXY=True),或者用静态代理(STATIC_PROXY_URL)。

  • 笔记不存在或已下架:code -510000 / -510001,触发 NoteNotFoundError,程序会跳过继续。

  • 并发过高被封:MAX_CONCURRENCY_NUM 默认 1,不建议调太高。

  • matplotlib 字体缓存在首次 import 时会耗时(约 10-15 秒),与爬虫本身无关,是安装 wordcloud 带来的副作用。可通过设置 MPLCONFIGDIR 环境变量绕开。

  • 小红书要求指定帖子的 URL 必须包含 xsec_token,直接从浏览器复制的"分享链接"通常是带有的,但"浏览器地址栏复制"可能需要手工确认是否完整。

  • 十二、与其他框架的对比

    对比项MediaCrawlerCrawl4AIScrapy
    面向场景 多平台自媒体 通用网页 通用站点
    浏览器支持 Playwright + CDP CDP/Playwright
    登录态管理 内置 内置 需自行处理
    签名处理 JS 注入 / xhshow 可自定义 需逆向
    平台覆盖 7 个 通用 通用
    上手难度

    MediaCrawler 的优势是"开箱即用"——不用逆向、不用写签名算法,只要扫码登录即可。缺点是灵活性不如自研,遇到平台大改版时依赖库的同步速度成为瓶颈。

    十三、总结

    MediaCrawler 是一个设计清晰的"自媒体爬虫全家桶",小红书模块尤其成熟:

    • 三条采集路线(搜索 / 详情 / 创作者)覆盖绝大多数场景;
    • 签名完全交给 xhshow 库,自研 Python 只负责 x-s-common;
    • CDP 模式让浏览器成为天然的"签名工厂",反检测效果最好;
    • 数据格式丰富,从 JSONL 到 SQL 数据库全覆盖。

    适合做内容监测、竞品调研、数据分析的原型开发。正式生产使用前要注意频率控制和合规边界。

    (完)@TOC

    欢迎使用Markdown编辑器

    你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。

    新的改变

    我们对Markdown编辑器进行了一些功能拓展与语法支持,除了标准的Markdown编辑器功能,我们增加了如下几点新功能,帮助你用它写博客:

  • 全新的界面设计 ,将会带来全新的写作体验;
  • 在创作中心设置你喜爱的代码高亮样式,Markdown 将代码片显示选择的高亮样式 进行展示;
  • 增加了 图片拖拽 功能,你可以将本地的图片直接拖拽到编辑区域直接展示;
  • 全新的 KaTeX数学公式 语法;
  • 增加了支持甘特图的mermaid语法1 功能;
  • 增加了 多屏幕编辑 Markdown文章功能;
  • 增加了 焦点写作模式、预览模式、简洁写作模式、左右区域同步滚轮设置 等功能,功能按钮位于编辑区域与预览区域中间;
  • 增加了 检查列表 功能。
  • 功能快捷键

    撤销:Ctrl/Command + Z 重做:Ctrl/Command + Y 加粗:Ctrl/Command + B 斜体:Ctrl/Command + I 标题:Ctrl/Command + Shift + H 无序列表:Ctrl/Command + Shift + U 有序列表:Ctrl/Command + Shift + O 检查列表:Ctrl/Command + Shift + C 插入代码:Ctrl/Command + Shift + K 插入链接:Ctrl/Command + Shift + L 插入图片:Ctrl/Command + Shift + G 查找:Ctrl/Command + F 替换:Ctrl/Command + G

    合理的创建标题,有助于目录的生成

    直接输入1次#,并按下space后,将生成1级标题。 输入2次#,并按下space后,将生成2级标题。 以此类推,我们支持6级标题。有助于使用TOC语法后生成一个完美的目录。

    如何改变文本的样式

    强调文本 强调文本

    加粗文本 加粗文本

    标记文本

    删除文本

    引用文本

    H2O is是液体。

    210 运算结果是 1024.

    插入链接与图片

    链接: link.

    图片: Alt

    带尺寸的图片: Alt

    居中的图片: Alt

    居中并且带尺寸的图片: Alt

    当然,我们为了让用户更加便捷,我们增加了图片拖拽功能。

    如何插入一段漂亮的代码片

    去博客设置页面,选择一款你喜欢的代码片高亮样式,下面展示同样高亮的 代码片.

    // An highlighted block
    var foo = 'bar';

    生成一个适合你的列表

    • 项目
      • 项目
        • 项目
  • 项目1
  • 项目2
  • 项目3
    • 计划任务
    • 完成任务

    创建一个表格

    一个简单的表格是这么创建的:

    项目Value
    电脑 $1600
    手机 $12
    导管 $1

    设定内容居中、居左、居右

    使用:———:居中 使用:———-居左 使用———-:居右

    第一列第二列第三列
    第一列文本居中 第二列文本居右 第三列文本居左

    SmartyPants

    SmartyPants 是一个文本转换工具,主要功能是将普通的 ASCII 标点符号自动转换为更美观的印刷体标点符号。例如:

    原始符号转换后说明
    "引号" “引号” 直引号变弯引号
    '单引号' ‘单引号’ 直单引号变弯单引号
    两个连字符变短破折号
    三个连字符变长破折号
    三个点变省略号

    创建一个自定义列表

    Markdown

    Text-to-
    HTML conversion tool

    Authors

    John
    Luke

    如何创建一个注脚

    一个具有注脚的文本。2

    注释也是必不可少的

    Markdown将文本转换为 HTML。

    KaTeX数学公式

    您可以使用渲染LaTeX数学表达式 KaTeX:

    Gamma公式展示

    Γ

    (

    n

    )

    =

    (

    n

    1

    )

    !

    n

    N

    \\Gamma(n) = (n-1)!\\quad\\forall n\\in\\mathbb N

    Γ(n)=(n1)!nN 是通过欧拉积分

    Γ

    (

    z

    )

    =

    0

    t

    z

    1

    e

    t

    d

    t

    .

    \\Gamma(z) = \\int_0^\\infty t^{z-1}e^{-t}dt\\,.

    Γ(z)=0tz1etdt.

    你可以找到更多关于的信息 LaTeX 数学表达式here.

    新的甘特图功能,丰富你的文章

    #mermaid-svg-536BiLRbV3a96wrV{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-536BiLRbV3a96wrV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-536BiLRbV3a96wrV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-536BiLRbV3a96wrV .error-icon{fill:#552222;}#mermaid-svg-536BiLRbV3a96wrV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-536BiLRbV3a96wrV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-536BiLRbV3a96wrV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-536BiLRbV3a96wrV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-536BiLRbV3a96wrV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-536BiLRbV3a96wrV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-536BiLRbV3a96wrV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-536BiLRbV3a96wrV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-536BiLRbV3a96wrV .marker.cross{stroke:#333333;}#mermaid-svg-536BiLRbV3a96wrV svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-536BiLRbV3a96wrV p{margin:0;}#mermaid-svg-536BiLRbV3a96wrV .mermaid-main-font{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-536BiLRbV3a96wrV .exclude-range{fill:#eeeeee;}#mermaid-svg-536BiLRbV3a96wrV .section{stroke:none;opacity:0.2;}#mermaid-svg-536BiLRbV3a96wrV .section0{fill:rgba(102, 102, 255, 0.49);}#mermaid-svg-536BiLRbV3a96wrV .section2{fill:#fff400;}#mermaid-svg-536BiLRbV3a96wrV .section1,#mermaid-svg-536BiLRbV3a96wrV .section3{fill:white;opacity:0.2;}#mermaid-svg-536BiLRbV3a96wrV .sectionTitle0{fill:#333;}#mermaid-svg-536BiLRbV3a96wrV .sectionTitle1{fill:#333;}#mermaid-svg-536BiLRbV3a96wrV .sectionTitle2{fill:#333;}#mermaid-svg-536BiLRbV3a96wrV .sectionTitle3{fill:#333;}#mermaid-svg-536BiLRbV3a96wrV .sectionTitle{text-anchor:start;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-536BiLRbV3a96wrV .grid .tick{stroke:lightgrey;opacity:0.8;shape-rendering:crispEdges;}#mermaid-svg-536BiLRbV3a96wrV .grid .tick text{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;fill:#333;}#mermaid-svg-536BiLRbV3a96wrV .grid path{stroke-width:0;}#mermaid-svg-536BiLRbV3a96wrV .today{fill:none;stroke:red;stroke-width:2px;}#mermaid-svg-536BiLRbV3a96wrV .task{stroke-width:2;}#mermaid-svg-536BiLRbV3a96wrV .taskText{text-anchor:middle;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-536BiLRbV3a96wrV .taskTextOutsideRight{fill:black;text-anchor:start;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-536BiLRbV3a96wrV .taskTextOutsideLeft{fill:black;text-anchor:end;}#mermaid-svg-536BiLRbV3a96wrV .task.clickable{cursor:pointer;}#mermaid-svg-536BiLRbV3a96wrV .taskText.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-536BiLRbV3a96wrV .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-536BiLRbV3a96wrV .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-536BiLRbV3a96wrV .taskText0,#mermaid-svg-536BiLRbV3a96wrV .taskText1,#mermaid-svg-536BiLRbV3a96wrV .taskText2,#mermaid-svg-536BiLRbV3a96wrV .taskText3{fill:white;}#mermaid-svg-536BiLRbV3a96wrV .task0,#mermaid-svg-536BiLRbV3a96wrV .task1,#mermaid-svg-536BiLRbV3a96wrV .task2,#mermaid-svg-536BiLRbV3a96wrV .task3{fill:#8a90dd;stroke:#534fbc;}#mermaid-svg-536BiLRbV3a96wrV .taskTextOutside0,#mermaid-svg-536BiLRbV3a96wrV .taskTextOutside2{fill:black;}#mermaid-svg-536BiLRbV3a96wrV .taskTextOutside1,#mermaid-svg-536BiLRbV3a96wrV .taskTextOutside3{fill:black;}#mermaid-svg-536BiLRbV3a96wrV .active0,#mermaid-svg-536BiLRbV3a96wrV .active1,#mermaid-svg-536BiLRbV3a96wrV .active2,#mermaid-svg-536BiLRbV3a96wrV .active3{fill:#bfc7ff;stroke:#534fbc;}#mermaid-svg-536BiLRbV3a96wrV .activeText0,#mermaid-svg-536BiLRbV3a96wrV .activeText1,#mermaid-svg-536BiLRbV3a96wrV .activeText2,#mermaid-svg-536BiLRbV3a96wrV .activeText3{fill:black!important;}#mermaid-svg-536BiLRbV3a96wrV .done0,#mermaid-svg-536BiLRbV3a96wrV .done1,#mermaid-svg-536BiLRbV3a96wrV .done2,#mermaid-svg-536BiLRbV3a96wrV .done3{stroke:grey;fill:lightgrey;stroke-width:2;}#mermaid-svg-536BiLRbV3a96wrV .doneText0,#mermaid-svg-536BiLRbV3a96wrV .doneText1,#mermaid-svg-536BiLRbV3a96wrV .doneText2,#mermaid-svg-536BiLRbV3a96wrV .doneText3{fill:black!important;}#mermaid-svg-536BiLRbV3a96wrV .doneText0.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneText0.taskTextOutsideRight,#mermaid-svg-536BiLRbV3a96wrV .doneText1.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneText1.taskTextOutsideRight,#mermaid-svg-536BiLRbV3a96wrV .doneText2.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneText2.taskTextOutsideRight,#mermaid-svg-536BiLRbV3a96wrV .doneText3.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneText3.taskTextOutsideRight{fill:black!important;}#mermaid-svg-536BiLRbV3a96wrV .crit0,#mermaid-svg-536BiLRbV3a96wrV .crit1,#mermaid-svg-536BiLRbV3a96wrV .crit2,#mermaid-svg-536BiLRbV3a96wrV .crit3{stroke:#ff8888;fill:red;stroke-width:2;}#mermaid-svg-536BiLRbV3a96wrV .activeCrit0,#mermaid-svg-536BiLRbV3a96wrV .activeCrit1,#mermaid-svg-536BiLRbV3a96wrV .activeCrit2,#mermaid-svg-536BiLRbV3a96wrV .activeCrit3{stroke:#ff8888;fill:#bfc7ff;stroke-width:2;}#mermaid-svg-536BiLRbV3a96wrV .doneCrit0,#mermaid-svg-536BiLRbV3a96wrV .doneCrit1,#mermaid-svg-536BiLRbV3a96wrV .doneCrit2,#mermaid-svg-536BiLRbV3a96wrV .doneCrit3{stroke:#ff8888;fill:lightgrey;stroke-width:2;cursor:pointer;shape-rendering:crispEdges;}#mermaid-svg-536BiLRbV3a96wrV .milestone{transform:rotate(45deg) scale(0.8,0.8);}#mermaid-svg-536BiLRbV3a96wrV .milestoneText{font-style:italic;}#mermaid-svg-536BiLRbV3a96wrV .doneCritText0,#mermaid-svg-536BiLRbV3a96wrV .doneCritText1,#mermaid-svg-536BiLRbV3a96wrV .doneCritText2,#mermaid-svg-536BiLRbV3a96wrV .doneCritText3{fill:black!important;}#mermaid-svg-536BiLRbV3a96wrV .doneCritText0.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneCritText0.taskTextOutsideRight,#mermaid-svg-536BiLRbV3a96wrV .doneCritText1.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneCritText1.taskTextOutsideRight,#mermaid-svg-536BiLRbV3a96wrV .doneCritText2.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneCritText2.taskTextOutsideRight,#mermaid-svg-536BiLRbV3a96wrV .doneCritText3.taskTextOutsideLeft,#mermaid-svg-536BiLRbV3a96wrV .doneCritText3.taskTextOutsideRight{fill:black!important;}#mermaid-svg-536BiLRbV3a96wrV .vert{stroke:navy;}#mermaid-svg-536BiLRbV3a96wrV .vertText{font-size:15px;text-anchor:middle;fill:navy!important;}#mermaid-svg-536BiLRbV3a96wrV .activeCritText0,#mermaid-svg-536BiLRbV3a96wrV .activeCritText1,#mermaid-svg-536BiLRbV3a96wrV .activeCritText2,#mermaid-svg-536BiLRbV3a96wrV .activeCritText3{fill:black!important;}#mermaid-svg-536BiLRbV3a96wrV .titleText{text-anchor:middle;font-size:18px;fill:#333;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-536BiLRbV3a96wrV :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

    2014-01-07

    2014-01-09

    2014-01-11

    2014-01-13

    2014-01-15

    2014-01-17

    2014-01-19

    2014-01-21

    已完成

    进行中

    计划一

    计划二

    现有任务

    Adding GANTT diagram functionality to mermaid

    • 关于 甘特图 语法,参考 这儿,

    UML图表

    可以使用UML图表进行渲染,例如下面产生的一个序列图:

    王五

    李四

    张三

    王五

    李四

    张三

    #mermaid-svg-9kjGvYNyvysSXVux{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-9kjGvYNyvysSXVux .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-9kjGvYNyvysSXVux .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-9kjGvYNyvysSXVux .error-icon{fill:#552222;}#mermaid-svg-9kjGvYNyvysSXVux .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-9kjGvYNyvysSXVux .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-9kjGvYNyvysSXVux .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-9kjGvYNyvysSXVux .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-9kjGvYNyvysSXVux .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-9kjGvYNyvysSXVux .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-9kjGvYNyvysSXVux .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-9kjGvYNyvysSXVux .marker{fill:#333333;stroke:#333333;}#mermaid-svg-9kjGvYNyvysSXVux .marker.cross{stroke:#333333;}#mermaid-svg-9kjGvYNyvysSXVux svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-9kjGvYNyvysSXVux p{margin:0;}#mermaid-svg-9kjGvYNyvysSXVux .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-9kjGvYNyvysSXVux text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-9kjGvYNyvysSXVux .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-9kjGvYNyvysSXVux .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-9kjGvYNyvysSXVux .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-9kjGvYNyvysSXVux .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-9kjGvYNyvysSXVux #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-9kjGvYNyvysSXVux .sequenceNumber{fill:white;}#mermaid-svg-9kjGvYNyvysSXVux #sequencenumber{fill:#333;}#mermaid-svg-9kjGvYNyvysSXVux #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-9kjGvYNyvysSXVux .messageText{fill:#333;stroke:none;}#mermaid-svg-9kjGvYNyvysSXVux .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-9kjGvYNyvysSXVux .labelText,#mermaid-svg-9kjGvYNyvysSXVux .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-9kjGvYNyvysSXVux .loopText,#mermaid-svg-9kjGvYNyvysSXVux .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-9kjGvYNyvysSXVux .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-9kjGvYNyvysSXVux .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-9kjGvYNyvysSXVux .noteText,#mermaid-svg-9kjGvYNyvysSXVux .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-9kjGvYNyvysSXVux .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-9kjGvYNyvysSXVux .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-9kjGvYNyvysSXVux .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-9kjGvYNyvysSXVux .actorPopupMenu{position:absolute;}#mermaid-svg-9kjGvYNyvysSXVux .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-9kjGvYNyvysSXVux .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-9kjGvYNyvysSXVux .actor-man circle,#mermaid-svg-9kjGvYNyvysSXVux line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-9kjGvYNyvysSXVux :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

    李四想了很长时间, 文字太长了

    不适合放在一行.

    你好!李四, 最近怎么样?

    你最近怎么样,王五?

    我很好,谢谢!

    我很好,谢谢!

    打量着王五…

    很好… 王五, 你怎么样?

    • 关于 UML图表 语法,参考 这儿,

    流程图

    #mermaid-svg-wYPbAMFZl8GpE4eR{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-wYPbAMFZl8GpE4eR .error-icon{fill:#552222;}#mermaid-svg-wYPbAMFZl8GpE4eR .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-wYPbAMFZl8GpE4eR .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-wYPbAMFZl8GpE4eR .marker{fill:#333333;stroke:#333333;}#mermaid-svg-wYPbAMFZl8GpE4eR .marker.cross{stroke:#333333;}#mermaid-svg-wYPbAMFZl8GpE4eR svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-wYPbAMFZl8GpE4eR p{margin:0;}#mermaid-svg-wYPbAMFZl8GpE4eR .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR .cluster-label text{fill:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR .cluster-label span{color:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR .cluster-label span p{background-color:transparent;}#mermaid-svg-wYPbAMFZl8GpE4eR .label text,#mermaid-svg-wYPbAMFZl8GpE4eR span{fill:#333;color:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR .node rect,#mermaid-svg-wYPbAMFZl8GpE4eR .node circle,#mermaid-svg-wYPbAMFZl8GpE4eR .node ellipse,#mermaid-svg-wYPbAMFZl8GpE4eR .node polygon,#mermaid-svg-wYPbAMFZl8GpE4eR .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-wYPbAMFZl8GpE4eR .rough-node .label text,#mermaid-svg-wYPbAMFZl8GpE4eR .node .label text,#mermaid-svg-wYPbAMFZl8GpE4eR .image-shape .label,#mermaid-svg-wYPbAMFZl8GpE4eR .icon-shape .label{text-anchor:middle;}#mermaid-svg-wYPbAMFZl8GpE4eR .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-wYPbAMFZl8GpE4eR .rough-node .label,#mermaid-svg-wYPbAMFZl8GpE4eR .node .label,#mermaid-svg-wYPbAMFZl8GpE4eR .image-shape .label,#mermaid-svg-wYPbAMFZl8GpE4eR .icon-shape .label{text-align:center;}#mermaid-svg-wYPbAMFZl8GpE4eR .node.clickable{cursor:pointer;}#mermaid-svg-wYPbAMFZl8GpE4eR .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-wYPbAMFZl8GpE4eR .arrowheadPath{fill:#333333;}#mermaid-svg-wYPbAMFZl8GpE4eR .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-wYPbAMFZl8GpE4eR .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-wYPbAMFZl8GpE4eR .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-wYPbAMFZl8GpE4eR .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-wYPbAMFZl8GpE4eR .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-wYPbAMFZl8GpE4eR .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-wYPbAMFZl8GpE4eR .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-wYPbAMFZl8GpE4eR .cluster text{fill:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR .cluster span{color:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-wYPbAMFZl8GpE4eR .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-wYPbAMFZl8GpE4eR rect.text{fill:none;stroke-width:0;}#mermaid-svg-wYPbAMFZl8GpE4eR .icon-shape,#mermaid-svg-wYPbAMFZl8GpE4eR .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-wYPbAMFZl8GpE4eR .icon-shape p,#mermaid-svg-wYPbAMFZl8GpE4eR .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-wYPbAMFZl8GpE4eR .icon-shape .label rect,#mermaid-svg-wYPbAMFZl8GpE4eR .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-wYPbAMFZl8GpE4eR .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-wYPbAMFZl8GpE4eR .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-wYPbAMFZl8GpE4eR :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

    链接

    长方形

    圆角长方形

    菱形

    • 关于 Mermaid 语法,参考 这儿,

    FLowchart流程图

    我们依旧会支持flowchart.js的流程图语法:

    Created with Raphaël 2.3.0

    开始

    我的操作

    确认?

    结束

    yes

    no

    • 关于 Flowchart流程图 语法,参考 这儿.

    导出与导入

    导出

    如果你想尝试使用此编辑器, 你可以在此篇文章任意编辑。当你完成了一篇文章的写作, 在上方工具栏找到 文章导出 ,生成一个.md文件或者.html文件进行本地保存。

    导入

    如果你想加载一篇你写过的.md文件,在上方工具栏可以选择导入功能进行对应扩展名的文件导入, 继续你的创作。


  • mermaid语法说明 ↩︎

  • 注脚的解释 ↩︎

  • 赞(0)
    未经允许不得转载:网硕互联帮助中心 » MediaCrawler 小红书爬虫深度调研 七个平台通用采集工具
    分享到: 更多 (0)

    评论 抢沙发

    评论前必须登录!