{"id":31970342,"url":"https://github.com/notsleeply/pyscript-githubrepo","last_synced_at":"2026-04-13T21:31:43.496Z","repository":{"id":316758981,"uuid":"1032610634","full_name":"NotSleeply/PyScript-GitHubRepo","owner":"NotSleeply","description":"这是一个用于自动下载指定 GitHub 用户仓库代码的工具，通过 Selenium 模拟浏览器操作，实现批量下载仓库的 ZIP 压缩包。","archived":false,"fork":false,"pushed_at":"2025-09-26T13:34:06.000Z","size":18287,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-26T15:27:24.304Z","etag":null,"topics":["github","python","python3","selenium","selenium-python","selenium-webdriver"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NotSleeply.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-05T14:56:19.000Z","updated_at":"2025-09-26T13:34:10.000Z","dependencies_parsed_at":"2025-09-26T15:37:28.124Z","dependency_job_id":null,"html_url":"https://github.com/NotSleeply/PyScript-GitHubRepo","commit_stats":null,"previous_names":["notsleeply/pyscript-githubrepo"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/NotSleeply/PyScript-GitHubRepo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotSleeply%2FPyScript-GitHubRepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotSleeply%2FPyScript-GitHubRepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotSleeply%2FPyScript-GitHubRepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotSleeply%2FPyScript-GitHubRepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NotSleeply","download_url":"https://codeload.github.com/NotSleeply/PyScript-GitHubRepo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NotSleeply%2FPyScript-GitHubRepo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020656,"owners_count":26086895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","python","python3","selenium","selenium-python","selenium-webdriver"],"created_at":"2025-10-14T19:14:03.665Z","updated_at":"2026-04-13T21:31:43.479Z","avatar_url":"https://github.com/NotSleeply.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub 仓库自动同步下载工具 (PyScript-GitHubRepo)\n\n一个现代化、高效、强健的 Python 工具，用于通过 GitHub API 批量下载或同步指定用户的所有开源仓库。完全摒弃了缓慢且容易出错的浏览器自动化（Selenium）方案，现已全面重构并模块化，为您提供丝滑的克隆与备份体验。\n\n## ✨ 核心特性\n\n- **🚀 多线程极速并发**：原生内置多线程支持（通过 `max_workers` 配置），海量仓库极速克隆或下载，不再需要等待单个排队。\n- **📦 双模式支持：Git Clone 与 ZIP 解压**\n  - **Git 模式**：通过 `GitPython`，本地若已有此仓库则自动触发 `git pull` 更新，否则 `git clone`，完美保留历史 Commit 和 Git 记录。\n  - **ZIP 模式**：使用 API 极速拉取打包的 Zip 源码文件并**自动解压处理**，自动清理带分支后缀（如 `repo-main`）的无用目录文件夹，还您清爽整洁的项目名。\n- **🔍 强大的按条件筛选**：\n  - `language`：仅下载指定编程语言的项目（如 `Python`, `JavaScript`）\n  - `min_stars`：设置最小星标数阈值，过滤掉无用仓库\n  - `updated_after`：指定日期后有更新的活跃仓库才被下载\n  - `max_repos`：限制最大操作仓库数，节省流量\n- **🔀 智能分支回退（Fallback）**：设定任意你想拉取的指定分支 `target_ref`。若该目标分支（或 Tag）不存在，系统将自动询问其真实**默认分支**并无感下潜回退，大幅消除 404/Branch Not Found 报错！\n- **♻️ 增量同步断点策略**：在目标目录通过 `last_sync.json` 文件全自动记录更新时间戳。如果没有新变更，工具直接跳过不浪费任何资源。\n- **🛡 重试与容错机制**：基于 `Tenacity` 的指数重试逻辑。自动辨别并处理网络波动波动、502 错误，把严重致命错误打印至日志 `app.log`，不再由于一个仓库坏掉导致整个进度崩溃。\n- **📊 自动化清单报表**：在下载结束时根据结果于目标目录（默认 `./reports`）生成 Markdown 或 CSV 格式的汇总报告。\n- **🎨 极美的命令行交互界面**：基于 `Rich` 构建的动态排版进度条，多任务执行状况一针见血，摆脱日志刷屏烦恼。\n\n## 🚀 快速启动\n\n### 1. 同步环境并安装依赖\n\n利用 `uv` 极速搭建虚拟环境及并配置项目所需库（GitPython, PyYAML, rich, tenacity 等）：\n\n```powershell\nuv sync\n```\n\n### 2. 准备配置 (极其重要！)\n\n在克隆或拉取大规模数量的内容时，极其容易触发 Github 的无授权访问速率限制 (Rate limit)。我们需要先提供一枚 Token：\n\n1. 访问你的 GitHub 账号生成 Token 页面：[Generate new token (classic)](https://github.com/settings/tokens)\n2. 无需勾选复杂权限（若只需下载公开仓库），生成并复制你的以 `ghp_` 开头的 Token。\n3. 复制项目根目录下的配置参考文件：\n\n```powershell\ncp config.example.yaml config.yaml\n```\n\n修改 `config.yaml` 填入你的信息：\n\n```yaml\ngithub:\n  username: \"codewithsadee\" # 想要爬取下载的 Github 用户名\n  token: \"ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXX\"  # 填入你的 Token 防止被限流\n\ndownload:\n  mode: \"git\"            # \"zip\" 或 \"git\"\n  save_path: \"./repos\"   # 仓库存放的目录\n  target_ref: \"main\"     # 默认拉取的分支或 Tag\n```\n\n### 3. 开始执行\n\n直接通过入口文件一键运行：\n\n```powershell\nuv run main.py\n```\n\n当然，你可以使用 **CLI 命令行参数** 对任意 YAML 配置进行临时覆盖重写：\n\n```powershell\n# 只下载最新的 3 个 Python 相关的带星仓库：\nuv run main.py --username tiangolo --language Python --min-stars 50 --max-repos 3 --mode git\n```\n\n执行完毕后系统将输出优美的总结报表，你也可以去目录内查看自动生成的 `.md` 文档报告哦！\n\n## 免责声明\n\n本工具仅用于学习和研究目的，使用者应自行承担使用本工具的一切风险和责任。请遵守以下原则：\n\n- 遵守 GitHub 的使用条款和访问速率限制\n- 尊重开源项目作者的知识产权和许可协议\n- 不要将下载的代码用于商业用途（除非原项目许可证明确允许）\n- 本工具的开发者不对因使用本工具而可能导致的任何问题或损失负责\n\n使用本工具即表示您同意上述免责声明。如果您不同意，请勿使用本工具。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotsleeply%2Fpyscript-githubrepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotsleeply%2Fpyscript-githubrepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotsleeply%2Fpyscript-githubrepo/lists"}