dsh-url-tools
by ZhijiangTang
DSH URL 工具插件。注册一个 url tool 工具,提供 URL 解析、跟踪参数清理、字符串编解码、重定向展开四种能力。 零依赖、纯 ESM、无构建 。
DSH plugin: URL parse / tracking-param cleanup / encode-decode / redirect expansion
安装
dsh plugin --profile web add github:ZhijiangTang/dsh-url-toolsGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
DSH URL 工具插件。注册一个 url_tool 工具,提供 URL 解析、跟踪参数清理、字符串编解码、重定向展开四种能力。零依赖、纯 ESM、无构建。
简介
- 工具名:
url_tool - 能力:
parse(解析)/clean(清理跟踪参数)/decode(解码)/encode(编码)/expand(展开重定向)。 - 行为:永不抛异常。参数错误、非法 URL、网络错误、非法
%序列都折叠为{ ok: false, error };成功返回{ ok: true, ... },且始终带回action回显。
安装
dsh plugin --profile <name> add file:./plugins/dsh-url-tools
# 或发布后:
dsh plugin --profile <name> add dsh-url-tools
参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
action |
enum | ✅ | parse/clean/decode/encode/expand |
url |
string | ✅ | 目标 URL(decode/encode 时是待处理字符串) |
action 表
| action | 输入 | 输出(ok: true) |
失败 |
|---|---|---|---|
parse |
任意合法 URL | { scheme, host, port, pathname, search, hash, username, params };params 为 key → [值...],重复键合并为数组 |
ok: false + error(非法 URL) |
clean |
含跟踪参数的 URL | { url, removed, search }:url 清理后完整 URL、removed 被删参数键数组、search 原始 query 串 |
ok: false + error(非法 URL) |
decode |
百分号编码串 | { input, output },整串 decodeURIComponent |
ok: false + error(非法 % 序列) |
encode |
任意字符串 | { input, output },整串 encodeURIComponent |
— |
expand |
任意 http/https URL |
{ finalUrl, hops, statuses };statuses 为每跳状态码(含末跳非 3xx) |
ok: false + error(网络错/非法 URL/非法 Location) |
parse 输出示例
// url_tool { action: "parse", url: "https://user:pw@example.com:8080/a/b?x=1&utm_source=g&y=2#f" }
{
"ok": true,
"action": "parse",
"scheme": "https",
"host": "example.com",
"port": "8080",
"pathname": "/a/b",
"search": "?x=1&utm_source=g&y=2",
"hash": "#f",
"username": "user",
"params": { "x": ["1"], "utm_source": ["g"], "y": ["2"] }
}
跟踪参数清单
clean 只删以下参数,其余(含 ref、gclsrc 等)一律保留:
utm_*(任意utm_前缀,如utm_source/utm_medium/utm_campaign/utm_term/utm_content/utm_id)fbclid、gclid、msclkid、mc_cid、mc_eid、yclid、wickedid
匹配对大小写不敏感;removed 返回被删的键(去重、按首次出现顺序)。
expand 上限说明
expand 手动跟随重定向:每跳先 HEAD、失败回退 GET,读 location 头(绝对/相对都解析),最多跟 5 跳。超过 5 跳仍在 3xx 时停止,返回当前 URL 并带 maxHopsReached: true;非 3xx(或无 location)即停。每跳超时 10 秒,网络错误返回 ok: false。
License
MIT
原始 README: https://github.com/ZhijiangTang/dsh-url-tools/blob/main/README.md ↗
同类插件
查看全部 →
dsh-anchored-standard
两阶段 DeepSeek Harness 预设:先 Minimal 对齐的 bootstrap,再切完整 Standard 工具(Project2 98/99)

PicGo-Core
极致的图片上传引擎,CLI 与 API 双支持

awesome-deepseek-harness
DeepSeek Harness(DSH)及其优秀社区插件的精选指南。

awesome-deepseek-harness
DeepSeek Harness (DSH)生态系统:来自dsh-external/hub和公共dsh-plugin主题的精选插件、工具和基础设施。

AI-Novel-Writer
本地优先 AI 小说创作工作台,提供 Windows/macOS 桌面版与 DeepSeek Harness 插件开发预览,支持角色、大纲、章节蓝图、审稿修稿和本地模型。

mcp-for-stata
MCP-for-Stata:把 Stata 集成进你的 agent