ejfkdev/dj

GitHub: ejfkdev/dj

通过静态分析网站HTML和JS代码,智能提取动态加载的JavaScript文件的工具。

Stars: 0 | Forks: 0

# dj - 动态 JS 文件提取器 [中文](./README.zh.md) | English [![Go Version](https://img.shields.io/badge/Go-1.25+-00ADD8.svg?style=flat-square)](https://golang.org/) [![License](https://img.shields.io/badge/License-MPL%202.0-blue.svg?style=flat-square)](LICENSE) [![Release](https://img.shields.io/github/v/release/ejfkdev/dj?style=flat-square)](https://github.com/ejfkdev/dj/releases) [![Build](https://img.shields.io/github/actions/workflow/status/ejfkdev/dj/build.yml?style=flat-square)](https://github.com/ejfkdev/dj/actions) [![Stars](https://img.shields.io/github/stars/ejfkdev/dj?style=flat-square)](https://github.com/ejfkdev/dj/stargazers) [![Forks](https://img.shields.io/github/forks/ejfkdev/dj?style=flat-square)](https://github.com/ejfkdev/dj/network/members) [![Issues](https://img.shields.io/github/issues/ejfkdev/dj?style=flat-square)](https://github.com/ejfkdev/dj/issues) [![Downloads](https://img.shields.io/github/downloads/ejfkdev/dj/total?style=flat-square)](https://github.com/ejfkdev/dj/releases) `dj` 通过静态分析网站 HTML 和 JS 代码(包括 webpack 代码块、import() 懒加载等)智能检测动态加载的 JavaScript 文件。 ## 功能 - 对网站 HTML 和 JS 进行深度分析,提取动态加载的 JavaScript 文件 - 智能检测动态加载模式:import()、require()、webpack 代码块、vite 预加载等 - 支持多种前端框架代码块映射:Next.js、Nuxt.js、Vite、SvelteKit、Webpack 等 - 自动发现 Source Map - 自定义 User-Agent 和代理支持 - 多种输出格式:text、JSON、markdown ## 安装 ### go install(推荐) ``` go install github.com/ejfkdev/dj@latest ``` ### 从源码构建 ``` git clone https://github.com/ejfkdev/dj.git cd dj go build -ldflags="-X main.version=1.0.0" -o dj . ``` ### 下载预编译二进制文件 访问 [Releases](https://github.com/ejfkdev/dj/releases) 页面下载适合您平台的二进制文件。 ## 使用方法 ``` dj [options] ``` ### 基本用法 ``` # 提取 JS URLs(实时输出) dj https://example.com # 以 JSON 格式输出 dj -f json https://example.com # 以 Markdown 格式输出 dj -f md https://example.com ``` ### 命令行选项 | 选项 | 描述 | |--------|-------------| | `--debug` | 启用调试输出 | | `-f ` | 输出格式:`text`(默认)、`json`、`md` | | `--cache` | 启用缓存(默认启用) | | `--cache=false` | 禁用缓存 | | `--useragent=` | 自定义 User-Agent 字符串 | | `--proxy=` | HTTP 代理 URL | | `-h` | 显示帮助信息 | ### 示例 ``` # 自定义 User-Agent dj --useragent="Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) ..." https://example.com # 使用代理 dj --proxy="http://127.0.0.1:7890" https://example.com # 启用调试模式 dj --debug https://example.com ``` ### 测试过的网站 | 网站 | JS 数量 | |---------|----------| | [docs.qq.com](https://docs.qq.com) | ~3270 | | [vue.ruoyi.vip](https://vue.ruoyi.vip) | ~68 | | [gitee.com](https://gitee.com) | ~63 | | [nuxt.com.cn](https://nuxt.com.cn) | ~160 | | [chat.z.ai](https://chat.z.ai) | ~539 | | [show.cool-admin.com/login](https://show.cool-admin.com/login) | ~120 | | [demo.1panel.cn](https://demo.1panel.cn) | ~161 | | [mail.qq.com](https://mail.qq.com) | ~418 | | [chat.deepseek.com](https://chat.deepseek.com) | ~634 | ``` dj https://docs.qq.com dj https://vue.ruoyi.vip dj https://gitee.com dj https://nuxt.com.cn dj https://chat.z.ai dj https://show.cool-admin.com/login dj https://demo.1panel.cn ``` ## 支持的模式和框架(16 个插件) | 框架/工具 | 功能 | |----------------|----------| | **HTMLScript** | 解析 `