{"id":17238218,"url":"https://github.com/evyatarmeged/humanoid","last_synced_at":"2025-04-10T06:37:06.246Z","repository":{"id":33173940,"uuid":"153926451","full_name":"evyatarmeged/Humanoid","owner":"evyatarmeged","description":"Node.js package to bypass CloudFlare's anti-bot JavaScript challenges","archived":false,"fork":false,"pushed_at":"2023-05-21T08:32:00.000Z","size":80,"stargazers_count":220,"open_issues_count":9,"forks_count":25,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T07:40:46.583Z","etag":null,"topics":["anti-bot","anti-bot-page","bot","bypass","bypass-waf","humanoid","scrape","scraping","web-scraping"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/evyatarmeged.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":"2018-10-20T16:40:58.000Z","updated_at":"2025-03-18T21:07:46.000Z","dependencies_parsed_at":"2024-06-18T20:12:48.914Z","dependency_job_id":"d7d08ff0-b662-4887-9536-05154d5d6074","html_url":"https://github.com/evyatarmeged/Humanoid","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"2713e92861c4f621244d30a39f9f29ad1780d89a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evyatarmeged%2FHumanoid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evyatarmeged%2FHumanoid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evyatarmeged%2FHumanoid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evyatarmeged%2FHumanoid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evyatarmeged","download_url":"https://codeload.github.com/evyatarmeged/Humanoid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248170995,"owners_count":21059287,"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-page","bot","bypass","bypass-waf","humanoid","scrape","scraping","web-scraping"],"created_at":"2024-10-15T05:44:57.078Z","updated_at":"2025-04-10T06:37:06.213Z","avatar_url":"https://github.com/evyatarmeged.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Humanoid\n![Build Status](https://travis-ci.org/evyatarmeged/Humanoid.svg?branch=master)\n![license](https://img.shields.io/badge/license-MIT-green.svg)\n![version](https://img.shields.io/badge/version-1.0.1-blue.svg)\n![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)\n\nA Node.js package to bypass WAF anti-bot JS challenges.\n\n## About\nHumanoid is a Node.js package to solve and bypass CloudFlare (and hopefully in the future - other WAFs' as well) JavaScript anti-bot challenges.\u003cbr\u003e\nWhile anti-bot pages are solvable via headless browsers, they are pretty heavy and are usually considered over the top for scraping.\u003cbr\u003e\nHumanoid can solve these challenges using the Node.js runtime and present the protected HTML page.\u003cbr\u003e\nThe session cookies can also be delegated to other bots to continue scraping causing them to avoid the JS challenges altogether.\n\n## Features\n * Random browser User-Agent \n * Auto-retry on failed challenges\n * Highly configurable - hack custom cookies, headers, etc\n * Clearing cookies and rotating User-Agent is supported\n * Supports decompression of `Brotli` content-encoding. Not supported by Node.js' `request` by default!\n \n \n## Installation\nvia npm:\n```\nnpm install --save humanoid-js\n```\n\n## Usage\nBasic usage with promises:\n```javascript\nconst Humanoid = require(\"humanoid-js\");\n\nlet humanoid = new Humanoid();\nhumanoid.get(\"https://www.cloudflare-protected.com\")\n    .then(res =\u003e {\n    \tconsole.log(res.body) // \u003c!DOCTYPE html\u003e\u003chtml lang=\"en\"\u003e...\n    })\n    .catch(err =\u003e {\n    \tconsole.error(err)\n    })\n```\nHumanoid uses auto-bypass by default. You can override it on instance creation:\n```javascript\nlet humanoid = new Humanoid(autoBypass=false)\n\nhumanoid.get(\"https://canyoupwn.me\")\n  .then(res =\u003e {\n  \tconsole.log(res.statusCode) // 503\n  \tconsole.log(res.isSessionChallenged) // true\n    humanoid.bypassJSChallenge(res)\n      .then(challengeResponse =\u003e {\n      \t// Note that challengeResponse.isChallengeSolved won't be set to true when doing manual bypassing.\n      \tconsole.log(challengeResponse.body) // \u003c!DOCTYPE html\u003e\u003chtml lang=\"en\"\u003e...\n      })\n    }\n  )\n\t.catch(err =\u003e {\n\t\tconsole.error(err)\n\t})\n```\n`async/await` is also supported, and is the preferred way to go:\n```javascript\n(async function() {\n  let humanoid = new Humanoid();\n  let response = await humanoid.sendRequest(\"www.cloudflare-protected.com\")\n  console.log(response.body) // \u003c!DOCTYPE html\u003e\u003chtml lang=\"en\"\u003e...\n}())\n```\n### Humanoid API Methods\n```javascript 1.8\n  rotateUA() // Replace the currently set user agent with a different one\n  \n  clearCookies() // \"Set a new, empty cookie jar for the humanoid instance\"\n  \n  get(url, queryString=undefined, headers=undefined) // Send a GET request to `url`.\n  // if passed, queryString and headers should be objects \n  \n  post(url, postBody=undefined, headers=undefined, dataType=undefined) // Send a POST request to `url`.\n  // `dataType` should be either \"form\" or \"json\" - based on the content type of the POST request.\n  \n  sendRequest(url, method=undefined, data=undefined, headers=undefined, dataType=undefined) \n  // Send a request of method `method` to `url`\n  \n  bypassJSChallenge(response) // Bypass the anti-bot JS challenge found in response.body\n```\n\n## TODOs\n- [ ] Add command line support\n    * Support a flag to return the cookie jar after challenge solved - for better integration with other tools and scrapers\n    * Have an option to simply bypass and return the protected HTML\n- [ ] Solve other WAFs similar anti-bot challenges\n- [ ] Add tests for request sending and challenge solving\n- [ ] Add Docker support :whale:\n\n## Issues and Contributions\nAll anti-bot challenges are likely to change in the future. If this is the case, please open an issue explaining \nthe problem - try to include the target page if possible. I'll do my best to keep the code up to date with\nnew challenges.\u003cbr\u003e\nAny and all contributions are welcome - and are highly appreciated.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevyatarmeged%2Fhumanoid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevyatarmeged%2Fhumanoid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevyatarmeged%2Fhumanoid/lists"}