{"id":37223001,"url":"https://github.com/unkmonster/tmd","last_synced_at":"2026-01-15T01:33:41.516Z","repository":{"id":249807383,"uuid":"817387834","full_name":"unkmonster/tmd","owner":"unkmonster","description":"批量下载推特上用户的媒体推文，支持通过用户列表和关注列表进行批量下载。","archived":false,"fork":false,"pushed_at":"2025-07-02T09:49:10.000Z","size":391,"stargazers_count":186,"open_issues_count":17,"forks_count":22,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-02T10:46:05.079Z","etag":null,"topics":["cli","downloader","twitter","x"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unkmonster.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}},"created_at":"2024-06-19T15:42:32.000Z","updated_at":"2025-07-02T09:49:14.000Z","dependencies_parsed_at":"2025-02-15T14:26:30.207Z","dependency_job_id":"a6dee1d3-6f2a-4a50-baac-ccbe56d764e3","html_url":"https://github.com/unkmonster/tmd","commit_stats":null,"previous_names":["unkmonster/tmd2"],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/unkmonster/tmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unkmonster%2Ftmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unkmonster%2Ftmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unkmonster%2Ftmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unkmonster%2Ftmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unkmonster","download_url":"https://codeload.github.com/unkmonster/tmd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unkmonster%2Ftmd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28441031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T00:55:22.719Z","status":"ssl_error","status_checked_at":"2026-01-15T00:55:20.945Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","downloader","twitter","x"],"created_at":"2026-01-15T01:33:40.978Z","updated_at":"2026-01-15T01:33:41.502Z","avatar_url":"https://github.com/unkmonster.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twitter Media Downloader\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/unkmonster/tmd.svg)](https://pkg.go.dev/github.com/unkmonster/tmd)\n[![Go Report Card](https://goreportcard.com/badge/github.com/unkmonster/tmd)](https://goreportcard.com/report/github.com/unkmonster/tmd)\n[![Coverage Status](https://coveralls.io/repos/github/unkmonster/tmd/badge.svg?branch=master)](https://coveralls.io/github/unkmonster/tmd?branch=master)\n[![Go](https://github.com/unkmonster/tmd/actions/workflows/go.yml/badge.svg)](https://github.com/unkmonster/tmd/actions/workflows/go.yml)\n![GitHub Release](https://img.shields.io/github/v/release/unkmonster/tmd) \n![GitHub License](https://img.shields.io/github/license/unkmonster/tmd?logo=github)\n\n跨平台的推特媒体下载器。用于轻松，快速，安全，整洁，批量的下载推特上用户的推文。支持手动指定用户或通过列表、用户关注批量下载。开箱即用！\n\n## Feature\n\n- 下载指定用户的媒体推文 (video, img, gif)\n- 保留推文标题\n- 保留推文发布日期，设置为文件的修改时间\n- 以列表为单位批量下载\n- 关注中的用户批量下载\n- 在文件系统中保留列表/关注结构\n- 同步用户/列表信息：名称，是否受保护，等。。。\n- 记录用户曾用名\n- 避免重复下载\n  - 每次工作后记录用户的最新发布时间，下次工作仅从这个时间点开始拉取用户推文\n  - 向列表目录发送指向用户目录的符号链接，无论多少列表包含同一用户，本地仅保存一份用户存档\n- 避免重复获取时间线：任意一段时间内的推文仅仅会从 twitter 上拉取一次，即使这些推文下载失败。如果下载失败将它们存储到本地，以待重试或丢弃\n- 避免重复同步用户（更新用户信息，获取时间线，下载推文）\n- 速率限制：避免触发 Twitter API 速率限制\n- 自动关注受保护的用户\n- 添加备用 cookie：提高推文获取速度和总数量\n\n## How to use\n\n### 下载/编译\n\n**直接下载**\n\n前往 [Release](https://github.com/unkmonster/tmd/releases/latest) 自行选择合适的版本并下载\n\n**自行编译**\n\n```bash\ngit clone https://github.com/unkmonster/tmd\ncd tmd\ngo build .\n```\n\n### 更新/填写配置\n\n第一次运行程序时，程序会询问如下配置信息，请按要求将配置项依次填入\n\n#### 配置项介绍\n\n1. `storeage path`：存储路径(可以不存在)\n2. `auth_token`：用于登录，[获取方式](https://github.com/unkmonster/tmd/blob/master/doc/help.md#获取-cookie)\n3. `ct0`：用于登录，[获取方式](https://github.com/unkmonster/tmd/blob/master/doc/help.md#获取-cookie)\n4. `max_download_routine`：最大并发下载协程数（如果为0取默认值）\n\n#### 更新配置\n\n```shell\ntmd --conf\n```\n\n\u003e **执行上述命令将导致引导配置程序重新运行，这将重新配置整个配置文件，而不是单独的配置项。单独修改配置项**请至 `%appdata%/.tmd2/conf.yaml` 或 `$HOME/.tmd2/conf.yaml`手动修改\n\n### 命令说明\n\n```\ntmd --help                 // 显示帮助\ntmd --conf                 // 重新运行配置程序\ntmd --user \u003cuser_id\u003e       // 下载由 user_id 指定的用户的推文\ntmd --user \u003cscreen_name\u003e   // 下载由 screen_name 指定的用户的推文\ntmd --list \u003clist_id\u003e       // 批量下载由 list_id 指定的列表中的每个用户\ntmd --foll \u003cuser_id\u003e       // 批量下载由 user_id 指定的用户正关注的每个用户\ntmd --foll \u003cscreen_name\u003e   // 批量下载由 screen_name 指定的用户正关注的每个用户\ntmd --auto-follow          // 自动关注受保护的用户\ntmd --no-retry             // 仅转储，不在程序退出前自动重试下载失败的推文\n```\n\n\u003e 为了创建符号链接，在 Windows 上应该以管理员身份运行程序\n\n[不知道啥是 user_id/list_id/screen_name?](https://github.com/unkmonster/tmd/blob/master/doc/help.md#%E8%8E%B7%E5%8F%96-list_id-user_id-screen_name)\n\n### 示例\n\n```\ntmd --user elonmusk  // 下载 screen_name 为 ‘eronmusk’ 的用户\ntmd --user 1234567   // 下载 user_id 为 1234567 的用户\ntmd --list 8901234   // 下载 list_id 为 8901234 的列表\ntmd --foll 567890    // 下载 user_id 为 567890 的用户正关注的所有用户\n```\n\n更推荐的做法：一次运行\n\n```shell\ntmd --user elonmusk --user 1234567 --list 8901234 --foll 567890\n```\n\n### 设置代理\n\n运行前通过环境变量指定代理服务器（TUN 模式跳过这一步）\n\n```bash\nset HTTP_PROXY=url\nset HTTPS_PROXY=url\n```\n\n示例：\n```bash\nset HTTP_PROXY=http://127.0.0.1:7890\nset HTTPS_PROXY=http://127.0.0.1:7890\ntmd --user elonmusk\n```\n\n如果你使用windows系统，在powershell中使用以下指令设置代理：\n```powershell\n$Env:HTTP_PROXY=\"http://127.0.0.1:7890\"\n$Env:HTTPS_PROXY=\"http://127.0.0.1:7890\"\n```\n\n### 忽略用户\n\n程序默认会忽略被静音或被屏蔽的用户，所以当你想要下载的列表中包含你不想包含的用户，可以在推特将他们屏蔽或静音\n\n### 添加额外 cookie\n\n程序动态从所有可用 cookie 中选择一个不会被速率限制的 cookie 请求用户推文，以避免因单一 cookie 的速率限制导致程序被阻塞。\n\n按如下格式创建 `$HOME/.tmd2/additional_cookies.yaml` 或 `%appdata%/.tmd2/additional_cookies.yaml`\n\n```yaml\n- auth_token: xxxxxxxxx1\n  ct0: xxxxxxxxxxxxxxxxxxxxxxx\n- auth_token: xxxxxxxxx2\n  ct0: xxxxxxxxxxxxxxxx2\n- auth_token: xxxxxxxxxxxxxxxx3\n  ct0: xxxxxxxxxxxxxxxxxxxxx3\n```\n\u003e 这些添加的备用 cookie，仅用来提升获取推文的速率和总量。判断是否忽略用户和自动关注受保护的用户依然使用主账号\n\n## Detail\n\n### 关于速率限制\n\nTwitter API 限制一段时间内过快的请求 （例如某端点每15分钟仅允许请求500次，超出这个次数会以429响应），当某一端点将要达到速率限制程序会打印一条通知并阻塞尝试请求这个端点的协程直到余量刷新（这最多是15分钟），但并不会阻塞所有协程，所以其余协程打印的消息可能将这条休眠通知覆盖让人认为程序无响应了，等待余量刷新程序会继续工作。\n\n## Contributors\n\n![](https://contrib.rocks/image?repo=unkmonster/tmd) \n\n## 交流群\n\ntg: https://t.me/+I4yyM81HaJpkNTll\n\n## 感谢\n\n本项目 CDN 加速及安全防护由 Tencent EdgeOne 赞助：EdgeOne 提供长期有效的免费套餐，包含不限量的流量和请求，覆盖中国大陆节点，且无任何超额收费，感兴趣的朋友可以点击下面的链接领取\n\n\u003ca href=\"https://edgeone.ai/zh?from=github\"\u003e亚洲最佳CDN、边缘和安全解决方案 - Tencent EdgeOne\u003c/a\u003e\n\n\u003cimg src=\"https://edgeone.ai/media/34fe3a45-492d-4ea4-ae5d-ea1087ca7b4b.png\" alt=\"图片alt\" title=\"图片title\"\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funkmonster%2Ftmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funkmonster%2Ftmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funkmonster%2Ftmd/lists"}