{"id":16831341,"url":"https://github.com/jonfriesen/playwright-go-stealth","last_synced_at":"2025-04-11T04:11:57.564Z","repository":{"id":242252493,"uuid":"809073783","full_name":"jonfriesen/playwright-go-stealth","owner":"jonfriesen","description":"🥷 A simple puppeteer evasions shim for playwright-go projects.","archived":false,"fork":false,"pushed_at":"2024-06-01T16:33:05.000Z","size":213,"stargazers_count":28,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T04:11:51.428Z","etag":null,"topics":["anti-bot","anti-bot-detection","playwright","playwright-go","stealth","web-scraping"],"latest_commit_sha":null,"homepage":"https://github.com/jonfriesen/playwright-go-stealth","language":"Go","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/jonfriesen.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}},"created_at":"2024-06-01T15:59:54.000Z","updated_at":"2025-04-08T13:44:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"c4a93c2b-08ad-4f0b-80df-50f3387e2c41","html_url":"https://github.com/jonfriesen/playwright-go-stealth","commit_stats":null,"previous_names":["jonfriesen/playwright-go-stealth"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fplaywright-go-stealth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fplaywright-go-stealth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fplaywright-go-stealth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fplaywright-go-stealth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonfriesen","download_url":"https://codeload.github.com/jonfriesen/playwright-go-stealth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339225,"owners_count":21087215,"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":["anti-bot","anti-bot-detection","playwright","playwright-go","stealth","web-scraping"],"created_at":"2024-10-13T11:43:16.104Z","updated_at":"2025-04-11T04:11:57.539Z","avatar_url":"https://github.com/jonfriesen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🥷 playwright-go-stealth\n\nThis is a simple shim to inject the [puppeteer-extra-plugin-stealth](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth) evasions using [berstend's extraction](https://github.com/berstend/puppeteer-extra/tree/master/packages/extract-stealth-evasions) for [playwright-go](https://github.com/playwright-community/playwright-go).\n\n| Example Comparison |\n|---------------------|\n| 🚨 Without the stealth script injected |\n| ![Without Stealth](images/without_stealth.png) |\n| ✅ With stealth script injected |\n| ![With Stealth](images/with_stealth.png) |\n\n## Usage\n\n```go\nimport stealth \"github.com/jonfriesen/playwright-go-stealth\"\n\n// pass a playwright.Page and the script will be injected\nerr = stealth.Inject(playwrightPage)\nif err != nil {\n    log.Fatalf(\"could not inject stealth script: %v\", err)\n}\n```\n\n## Example\n\nThe `example/main.go` will generate two, full page screenshots showing the bot detection results. This can be run with `go run example/main.go` and the screenshots will be saved in the location you run the command from.\n\n## Updates\nThe `stealth.min.js` file will be periodically updated in this repo. Further updates or specific versions are not supported or tracked at this time. However, I would accept contributions to include this functionality.\n\nRunning `make update-stealth-js` will pull the latest evasions script.\n\n\u003e Note: This requires `npx`.\n\n## Additional Stealth Tips\n\n### Disable blink automation control\n\n```go\nbrowser, err = m.PW.Chromium.Launch(playwright.BrowserTypeLaunchOptions{\n    Args: []string{\"--disable-blink-features=AutomationControlled\"},\n})\n```\n\n### Set a custom UserAgent\n[🔗 UserAgent Repositry](https://explore.whatismybrowser.com/useragents/explore/)\n```go\nconst userAgent = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9\"\npage, err := browser.NewPage(playwright.BrowserNewPageOptions{\n    UserAgent: playwright.String(userAgent),\n})\n```\n\n### Experiment with less common headers\n```go\npage, err := browser.NewPage(playwright.BrowserNewPageOptions{\n    ExtraHttpHeaders: map[string]string{\n        \"Cache-Control\":      \"no-cache\",\n        \"Sec-Ch-Ua\":          `\"Google Chrome\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"`,\n        \"Sec-Ch-Ua-Platform\": \"macOS\",\n    },\n})\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonfriesen%2Fplaywright-go-stealth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonfriesen%2Fplaywright-go-stealth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonfriesen%2Fplaywright-go-stealth/lists"}