### Adding Language Links Source: https://github.com/xifangczy/cat-catch-docs/blob/main/README.md Example of updating the language switcher in the README files. ```markdown [简体中文](./README.md) | [English](./README-en.md) | [日本語](./README-ja.md) ``` -------------------------------- ### Local Development Commands Source: https://github.com/xifangczy/cat-catch-docs/blob/main/README.md Common CLI commands for managing the development and build lifecycle of the documentation site. ```bash # 安装依赖 pnpm install # 启动开发服务器(热更新) pnpm docs:dev # 构建生产版本(输出到 .vitepress/dist) pnpm docs:build # 本地预览构建结果 pnpm docs:preview ``` -------------------------------- ### window.postMessage(catCatchAddMedia) Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/tampermonkey.md Sends a media resource to the Cat Catch extension to be added to the resource list. ```APIDOC ## window.postMessage({ action: "catCatchAddMedia" }) ### Description Sends a media resource object to the Cat Catch extension. This allows external scripts to inject resources that the extension might not automatically detect. ### Parameters - **action** (string) - Required - Must be "catCatchAddMedia". - **url** (string) - Required - The URL of the resource. - **href** (string) - Required - The current page URL (location.href). - **ext** (string) - Optional - The file extension of the resource. - **mime** (string) - Optional - The MIME type of the resource (e.g., video/mp4). - **referer** (string) - Optional - The referer header required to access the resource. ### Request Example ```javascript window.postMessage({ action: "catCatchAddMedia", url: "https://example.com/video.mp4", href: location.href, ext: "mp4", mime: "video/mp4", referer: "https://example.com" }); ``` ``` -------------------------------- ### 发送资源到猫抓 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/tampermonkey.md 使用 window.postMessage 发送资源对象,包含 URL、来源页面及可选的 MIME 类型和 Referer。 ```javascript window.postMessage({ action: "catCatchAddMedia", url: "https://github.com/xifangczy/cat-catch", href: location.href, ext: "test", mime: "test/text", referer: "https://github.com", }); ``` -------------------------------- ### Project Directory Structure Source: https://github.com/xifangczy/cat-catch-docs/blob/main/README.md Overview of the file organization for the VitePress documentation project. ```text cat-catch-docs/ ├── .github/workflows/ # GitHub Actions 部署工作流 ├── .vitepress/ │ └── config.mts # VitePress 配置(srcDir、双语、侧边栏、搜索等) ├── src/ # 所有 VitePress 内容(srcDir) │ ├── docs/ # 中文文档 │ ├── en/ # 英文文档 │ │ └── docs/ │ ├── public/ # 静态资源(原样复制到构建产物) │ │ └── assets/ # 图片资源 │ └── index.md # 中文首页 └── package.json ``` -------------------------------- ### 使用${range}标签生成切片URL Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/m3u8parse.md 通过${range}标签可以快速生成连续的切片URL序列,支持指定范围和强制补零格式。 ```text https://bmmmd.com/1.ts https://bmmmd.com/2.ts https://bmmmd.com/3.ts ``` ```text https://bmmmd.com/001.ts https://bmmmd.com/002.ts https://bmmmd.com/003.ts ``` -------------------------------- ### 发送 Blob 资源到猫抓 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/tampermonkey.md 通过 fetch 获取资源并转换为 Blob 对象,随后生成本地 URL 发送给猫抓进行处理。 ```javascript fetch("https://bmmmd.com/") .then((response) => response.blob()) .then(function (blob) { window.postMessage({ action: "catCatchAddMedia", url: window.URL.createObjectURL(blob), href: location.href, ext: "html", }); }); ``` -------------------------------- ### 启用迅雷下载协议 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/invoke.md 通过 thunder 协议调用迅雷下载,支持对 URL 进行 base64 编码。 ```text thunder://${url|exists:"AA*ZZ"|to:base64} ``` -------------------------------- ### 发送密钥到猫抓 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/tampermonkey.md 使用 catCatchAddKey 操作发送经过 Base64 编码或 ArrayBuffer 格式的密钥数据。 ```javascript window.postMessage({ action: "catCatchAddKey", key: "aHR0cHM6Ly9ibW1tZC5jb20=", href: location.href, ext: "base64Key", }); ``` -------------------------------- ### Match Facebook CDN URLs Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/regex-examples.md Matches Facebook CDN URLs containing a bytestart parameter. ```regex (^https://.*\.fbcdn\.net/.*)&bytestart=.* ``` -------------------------------- ### 测试调用参数 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/invoke.md 添加 --cat-catch-test 参数以在执行前预览即将调用的程序路径及参数。 ```text m3u8dlre:"${url}" --cat-catch-test ``` -------------------------------- ### Match Instagram CDN URLs Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/regex-examples.md Matches Instagram CDN URLs containing a bytestart parameter. ```regex (^https://scontent[a-z0-9-]*\.cdninstagram\.com/.*)&bytestart=.* ``` -------------------------------- ### window.postMessage(catCatchAddKey) Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/tampermonkey.md Sends a decryption key to the Cat Catch m3u8 parser. ```APIDOC ## window.postMessage({ action: "catCatchAddKey" }) ### Description Sends a decryption key to the Cat Catch extension for use in m3u8 stream decryption. This is useful for sites where the key is not directly embedded in the file. ### Parameters - **action** (string) - Required - Must be "catCatchAddKey". - **key** (string/ArrayBuffer) - Required - The key data, either base64 encoded or as an ArrayBuffer. - **href** (string) - Required - The current page URL (location.href). - **ext** (string) - Optional - Specifies the key format ("base64Key" or "key"). ### Request Example ```javascript window.postMessage({ action: "catCatchAddKey", key: "aHR0cHM6Ly9leGFtcGxlLmNvbQ==", href: location.href, ext: "base64Key" }); ``` ``` -------------------------------- ### 配置 N_m3u8DL-RE 调用参数 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/invoke.md 使用 URLProtocol 注册协议后,在插件设置中配置调用参数以实现自动下载。 ```text m3u8dlre:"${url}" --save-dir "%USERPROFILE%\Downloads" --del-after-done --save-name "${title}_${now}" --auto-select ${referer|exists:'-H "Referer: *"'} ``` -------------------------------- ### 使用 PotPlayer 播放 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/invoke.md 通过 potplayer 协议调用本地播放器,并根据需要传递 referer 参数。 ```text potplayer:${url} ${referer|exists:'/referer="*"'} ``` -------------------------------- ### N_m3u8DL-RE 默认下载参数 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/m3u8dl.md 配置下载路径、文件名格式及请求头信息的默认参数模板。 ```text "${url}" --save-dir "%USERPROFILE%\Downloads\m3u8dl" --save-name "${title}_${now}" ${referer|exists:'-H "Referer:*"'} --del-after-done --no-log ``` -------------------------------- ### 设置自定义请求头 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/m3u8parse.md 在解析器中设置复杂的请求头时,需要使用JSON格式进行配置。 ```json {"origin":"https://www.bmmmd.com","referer":"https://www.bmmmd.com/test.m3u8"} ``` -------------------------------- ### 配置数据发送格式 Source: https://github.com/xifangczy/cat-catch-docs/blob/main/src/docs/settings.md 定义发送到第三方地址的JSON请求体结构,支持使用特殊标签进行动态数据替换。 ```json // {"action": "${action}", "data": ${data}, "tabId": "${tabId}"} { action: "catch", data: { name: "文件名", url: "资源地址", size: "资源大小" requestHeaders: { referer: "也可能不存在", origin: "也可能不存在", cookie: "也可能不存在" } ...: "其他" }, tabId: "数据来源的tab ID" } // JSON 接收到疑似密钥 { action: "addKey", data: "base64数据", tabId: "数据来源的tab ID" } ``` -------------------------------- ### Registering a New Language in VitePress Source: https://github.com/xifangczy/cat-catch-docs/blob/main/README.md Configuration snippet for adding a new locale to the .vitepress/config.mts file. ```typescript import { defineConfig } from "vitepress"; export default defineConfig({ // ... locales: { root: { /* ... */ }, en: { /* ... */ }, ja: { label: "日本語", lang: "ja", link: "/ja/", description: "ウェブメディア取得ブラウザ拡張", themeConfig: { nav: [ /* 翻译后的导航栏 */ ], sidebar: [ /* 翻译后的侧边栏,链接前缀改为 /ja/ */ ], docFooter: { prev: "前へ", next: "次へ" }, outline: { label: "On This Page" }, sidebarMenuLabel: "メニュー", returnToTopLabel: "トップへ戻る", }, }, }, themeConfig: { // ... search: { provider: "local", options: { locales: { ja: { translations: { button: { buttonText: "ドキュメントを検索", buttonAriaLabel: "ドキュメントを検索" }, modal: { noResultsText: "結果が見つかりません", resetButtonTitle: "検索条件をクリア", footer: { selectText: "選択", navigateText: "移動", closeText: "閉じる" }, }, }, }, }, }, }, }, }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.