{"id":17527019,"url":"https://github.com/zhifengle/gcookie","last_synced_at":"2025-08-11T14:38:48.228Z","repository":{"id":47268389,"uuid":"516002008","full_name":"zhifengle/gcookie","owner":"zhifengle","description":"A tool for getting site cookie from browser","archived":false,"fork":false,"pushed_at":"2024-10-12T09:01:48.000Z","size":85,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-12T15:46:31.214Z","etag":null,"topics":["chrome","cookie","firefox"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/zhifengle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-07-20T13:53:13.000Z","updated_at":"2024-10-12T09:01:51.000Z","dependencies_parsed_at":"2024-04-02T10:41:19.499Z","dependency_job_id":"b32449f8-8f21-463c-8c2d-ee409ef7212f","html_url":"https://github.com/zhifengle/gcookie","commit_stats":null,"previous_names":["22earth/gcookie"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhifengle%2Fgcookie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhifengle%2Fgcookie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhifengle%2Fgcookie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhifengle%2Fgcookie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhifengle","download_url":"https://codeload.github.com/zhifengle/gcookie/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230438185,"owners_count":18225870,"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":["chrome","cookie","firefox"],"created_at":"2024-10-20T15:02:57.129Z","updated_at":"2024-12-19T13:07:46.057Z","avatar_url":"https://github.com/zhifengle.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# gcookie\n\nA tool for getting site cookie from your browser.\n\n\u003e [!note]  \n\u003e Chrome above 130 has changed the security of Chrome cookies on Windows, please try running gcookie with administrator privileges.\n\n## About\n\nWhen you write a script for scraping some data, you may need the cookie of the site.\nInstead of copying cookie string from Browser, you can use the std output of this tool.\n\n```javascript\nconst { execSync } = require('child_process');\nlet site = 'bing.com';\nconst cookie = execSync(`gcookie ${site}`).toString();\n```\n\n```python\nfrom subprocess import check_output\nsite = 'https://cn.bing.com'\n# output of cookies in `cn.bing.com`. not `bing.com`\ncookie = check_output(['gcookie', '-c', 'Edge', site]).decode(\"utf-8\")\n# example in Scrapy\ndef get_cookies_dict(cookies):\n    if not cookies:\n        return {}\n    return {c.split('=')[0]: c.split('=')[1] for c in cookies.split('; ')}\n\nclass DemoSpider(scrapy.Spider):\n    name = 'demo'\n\n    def start_requests(self):\n        cookies_dict = get_cookies_dict(\"your_cookies\")\n        yield scrapy.Request(\n            url,\n            headers={'Content-Type': 'application/json'},\n            cookies=cookies_dict,\n            callback=self.parse,\n        )\n```\n\n\u003e [!note]  \n\u003e If you're a JavaScript or Python user, please check out [thewh1teagle/rookie](https://github.com/thewh1teagle/rookie).\n\u003e Initially, I was developing this tool without the rookie library, but I have now switched to using it.\n\n## Supported Browser\n\n### Windows\n\nFirefox, Chrome, Edge, Chromium\n\n### Linux\n\nFirefox\n\n## Install\n\ndownload the [release](https://github.com/zhifengle/gcookie/releases) for your system and run the binary\n\n## Usage\n\n```text\nUsage: gcookie [OPTIONS] \u003csite\u003e\n\n```\n\n`gcookie -h` print help infomation.\n\n## Examples\n\n```shell\n# App would use Chrome's cookie\n\u003e gcookie \"google.com\"\n1P_JAR=2022-07-20-12; APISID=xxxyyyyy\n\n# App would use Edge's cookie\n\u003e gcookie -c Edge \"bing.com\"\n\n# App would use Firefox's cookie\n\u003e gcookie -f /path/to/profiles/xx.p \"bing.com\"\n\n# App would use Chrome's cookie in this path\n\u003e gcookie -p \"/path/to/User Data/Default\" \"bing.com\"\n```\n\n## Lib Usage\n\nAdd this to your Cargo.toml\n\n```toml\n[dependencies]\ngcookie = \"0.1.1\"\n```\n\n\u003e [!note]  \n\u003e Version 0.1.0 introduces a breaking change: the API has changed.\n\u003e It now uses the library \"rookie\" as the backend to read cookies.\n\u003e The original internal cookie reading function is deprecated.\n\nget cookie by Chrome\n\n```rust\nlet site = \"http://google.com\";\nlet cookie = gcookie::get_cookies(\"chrome\", site);\n\nlet site = \"bing.com\";\nlet browser = \"Edge\";\nlet cookie = gcookie::get_cookies(browser, site);\nassert!(cookie.is_ok());\n\nlet site = \"https://google.com\";\nlet mut path = PathBuf::new();\npath.push(r\"C:\\my_chrome\\user data\\default\");\nlet cookie =  match gcookie::get_chrome_cookies_by_path(site, \u0026path) {\n    Ok(cookie) =\u003e cookie,\n    Err(err) =\u003e panic!(\"An error occurred when get cookie '{}': {}\", site, err),\n};\n```\n\nget cookie by Firefox with path\n\n```rust\nlet site = \"https://www.mozilla.org/\";\n\nlet mut path = PathBuf::new();\npath.push(r\"C:\\my_firefox\\profile\");\n\nlet cookie =  match gcookie::get_firefox_cookies_by_path(site, \u0026path) {\n    Ok(cookie) =\u003e cookie,\n    Err(err) =\u003e panic!(\"An error occurred when get cookie '{}': {}\", site, err),\n};\n```\n\n## Development\n\n```shell\ngit clone https://github.com/zhifengle/gcookie\n\n# Build\ncd gcookie\ncargo build\n\n# Run unit tests and integration tests\ncargo test\n\n# Install\ncargo install --path .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhifengle%2Fgcookie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhifengle%2Fgcookie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhifengle%2Fgcookie/lists"}