{"id":28718722,"url":"https://github.com/zhhtdm/fetch-with-cookie","last_synced_at":"2026-05-19T05:31:30.905Z","repository":{"id":293870709,"uuid":"985375753","full_name":"zhhtdm/fetch-with-cookie","owner":"zhhtdm","description":"「网络服务」playwright 控制的 chromium-headless 浏览器服务","archived":false,"fork":false,"pushed_at":"2025-05-27T08:21:57.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T05:03:29.034Z","etag":null,"topics":["chromium-headless","cookie","playwright","remote-debugging"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhhtdm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-05-17T16:23:16.000Z","updated_at":"2025-05-27T08:22:01.000Z","dependencies_parsed_at":"2025-05-17T17:22:06.496Z","dependency_job_id":"328743ce-854e-45ff-b4b7-7e13dc87ece4","html_url":"https://github.com/zhhtdm/fetch-with-cookie","commit_stats":null,"previous_names":["zhhtdm/fetch-with-cookie"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zhhtdm/fetch-with-cookie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhhtdm%2Ffetch-with-cookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhhtdm%2Ffetch-with-cookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhhtdm%2Ffetch-with-cookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhhtdm%2Ffetch-with-cookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhhtdm","download_url":"https://codeload.github.com/zhhtdm/fetch-with-cookie/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhhtdm%2Ffetch-with-cookie/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259992396,"owners_count":22942766,"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","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":["chromium-headless","cookie","playwright","remote-debugging"],"created_at":"2025-06-15T05:03:28.205Z","updated_at":"2025-10-26T12:31:49.262Z","avatar_url":"https://github.com/zhhtdm.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fetch with cookie\n内部为一个`playwright`控制的`chromium-headless`浏览器\n- 以在保存使用`cookie`环境下并尽量模拟正常浏览器行为来获取网页内容\n- 可通过远程调试进行网站登录来更新`cookie`\n- 可配置最大网页数、超时时间和重试次数\n- 支持 `br` `gzip` 压缩传输\n\n## API\n```\nhttp(s)://service.domain/path?token=your-token\u0026url=\n```\n- `url`参数需要编码转义:\n```JavaScript\n// js\nencodeURIComponent(url)\n```\n```python\n# python\nimport urllib.parse\nurllib.parse.quote(url, safe='')\n```\n- 服务首次运行时，`playwright`会自动安装依赖，此过程可能长达数分钟\n## 远程调试\n\n远程调试服务端口默认为`9222`，默认绑定到`127.0.0.1`，\n此时外网不能访问，可以通过 SSH 隧道方式安全访问:\n```bash\n# 本地执行: ssh -L 本地端口:目标地址:目标端口 user@远程server\nssh -L 9222:localhost:9222 user@server\n```\n`chrome`访问[`chrome://inspect#devices`](chrome://inspect#devices)，即可在本地浏览器访问远程浏览器的调试页面，SSH 登出时，开启的 SSH 隧道会自动关闭\n## 项目环境变量 (.env)\n在项目根目录下创建 .env 文件，`TOKEN` 项必须配置，其他项可以省略，示例:\n```\nTOKEN=abcdef\nAPP_PATH=\"\"\nHOST=127.0.0.1\nPORT=9000\nREMOTE_DEBUGGING_PORT=9222\nREMOTE_DEBUGGING_ADDRESS=127.0.0.1\nMAX_CONCURRENT_PAGES=8\nPAGE_TIMEOUT=30000\nMAX_RETRIES=2\n```\n- **`TOKEN`: 验证令牌，防止滥用**\n- `APP_PATH`: 服务路径，默认为空\n- `PORT`: 服务监听端口，默认为 `8000`\n- `HOST`: 默认绑定内网 `127.0.0.1`\n- `REMOTE_DEBUGGING_PORT`: 远程调试端口，默认为`9222`\n- `REMOTE_DEBUGGING_ADDRESS`: 远程调试地址，默认为 `127.0.0.1`\n- `MAX_CONCURRENT_PAGES`: 最大同时打开的网页数，默认为 `8`\n- `PAGE_TIMEOUT`: 超时时间，单位毫秒，默认为`30000`\n- `MAX_RETRIES`: 最大重试数，默认为`2`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhhtdm%2Ffetch-with-cookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhhtdm%2Ffetch-with-cookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhhtdm%2Ffetch-with-cookie/lists"}