{"id":50268009,"url":"https://github.com/xcrap-dev/axios-client","last_synced_at":"2026-05-27T15:03:40.719Z","repository":{"id":285600329,"uuid":"958191113","full_name":"xcrap-dev/axios-client","owner":"xcrap-dev","description":"Xcrap Axios Client is a package of the Xcrap framework that implements an HTTP client using the Axios library.","archived":false,"fork":false,"pushed_at":"2026-03-11T04:56:12.000Z","size":222,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-12T14:52:27.662Z","etag":null,"topics":["axios","client","http","scraping","web","xcrap"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@xcrap/axios-client","language":"TypeScript","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/xcrap-dev.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-31T19:43:52.000Z","updated_at":"2026-03-04T16:25:27.000Z","dependencies_parsed_at":"2025-04-01T17:42:39.315Z","dependency_job_id":"9f27d0ef-4f06-47aa-b10b-5abd4ad9902d","html_url":"https://github.com/xcrap-dev/axios-client","commit_stats":null,"previous_names":["xcrap-cloud/axios-client","xcrap-dev/axios-client"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xcrap-dev/axios-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Faxios-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Faxios-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Faxios-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Faxios-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xcrap-dev","download_url":"https://codeload.github.com/xcrap-dev/axios-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Faxios-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33570993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["axios","client","http","scraping","web","xcrap"],"created_at":"2026-05-27T15:03:28.136Z","updated_at":"2026-05-27T15:03:40.714Z","avatar_url":"https://github.com/xcrap-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🕷️ Xcrap Axios Client\n\n**Xcrap Axios Client** is a package of the Xcrap framework that implements an HTTP client using the [Axios](https://www.npmjs.com/package/axios) library.\n\n## 📦 Installation\n\nThere are no secrets to installing it, just use your favorite dependency manager. Here is an example using NPM:\n\n```cmd\nnpm i @xcrap/axios-client @xcrap/core @xcrap/parser\n```\n\n\u003e You need to install `@xcrap/core` and `@xcrap/parser` as well because I left them as `peerDependencies`, which means that the package needs `@xcrap/core` and `@xcrap/parser` as dependencies, however, the ones that the user has installed in the project will be used.\n\n## 🚀 Usage\n\nLike any HTTP client, `AxiosClient` has two methods: `fetch()` to make a request for a specific URL and `fetchMany()` to make requests for multiple URLs at the same time, being able to control concurrency and delays between requests.\n\n### Example usage\n\n```ts\nimport { AxiosClient } from \"@xcrap/axios-client\"\nimport { extract } from \"@xcrap/parser\"\n\n;(async() =\u003e { \n    const client = new AxiosClient() \n    const url = \"https://example.com\" \n    const response = await client.fetch({ url: url }) \n    const parser = response.asHtmlParser() \n    const pageTitle = await parser.parseFist({ query: \"title\", extractor: extract(\"innerText\") }) \n\n    console.log(\"Page Title:\", pageTitle)\n})();\n```\n\n### Adding a proxy\n\nIn an HTTP client that extends `BaseClient` we can add a proxy in the constructor as we can see in the following example:\n\n1. **Providing a `proxy` object:\n\n```ts\nconst client = new AxiosClient({\n    proxy: {\n        host: \"47.251.122.81\",\n        port: \"8888\",\n        protocol: \"http\"\n    }\n})\n```\n\n2. **Providing a function that will generate a `proxy`:**\n\n```ts\nfunction randomProxy() {\n    const proxies = [\n        {\n            host: \"47.251.122.81\",\n            port: \"8888\",\n            protocol: \"http\"\n        },\n        {\n            host: \"159.203.61.169\",\n            port: \"3128\",\n            protocol: \"http\"\n        }\n    ]\n\n    const randomIndex = Math.floor(Math.random() * proxies.length)\n\n    return proxies[randomIndex]\n}\n\nconst client = new AxiosClient({ proxy: randomProxy })\n```\n\n### Using a custom User Agent\n\nIn a client that extends `BaseClient` we can also customize the `User-Agent` of the requests. We can do this in two ways:\n\n1. **By providing a `userAgent` string:\n\n```ts\nconst client = new AxiosClient({ userAgent: \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36\" })\n```\n\n2. **By providing a function that will generate a `userAgent`:**\n\n```ts\nfunction randomUserAgent() {\n    const userAgents = [\n        \"Mozilla/5.0 (iPhone; CPU iPhone OS 9_8_4; like Mac OS X) AppleWebKit/603.37 (KHTML, like Gecko) Chrome/54.0.1244.188 Mobile Safari/601.5\", \"Mozilla/5.0 (Windows NT 10.3;; en-US) AppleWebKit/537.35 (KHTML, like Gecko) Chrome/47.0.1707.185 Safari/601\"\n    ]\n\n    const randomIndex = Math.floor(Math.random() * userAgents.length)\n\n    return userAgents[randomIndex]\n}\n\nconst client = new AxiosClient({ userAgent: randomUserAgent })\n```\n\n### Using custom Proxy URL\n\nIn a client that extends `BaseClient` we can use proxy URLs, I don't know how to explain to you how they work, but I kind of discovered this kind of porxy when I was trying to solve the CORS problem by making a request on the client side, and then I met the *CORS Proxy*. Here I have a [template](https://gist.github.com/marcuth/9fbd321b011da44d1287faae31a8dd3a) for one for CloudFlare Workers in case you want to roll your own.\n\nWell, we can do it the same way we did with `userAgent`:\n\n1. **Providing a `proxyUrl` string:\n\n```ts\nconst client = new AxiosClient({ proxyUrl: \"https://my-proxy-app.my-username.workers.dev\" })\n```\n\n2. **Providing a function that will generate a `proxyUrl`:**\n\n```ts\nfunction randomProxyUrl() {\n    const proxyUrls = [\n        \"https://my-proxy-app.my-username-1.workers.dev\",\n        \"https://my-proxy-app.my-username-2.workers.dev\"\n    ]\n\n    const randomIndex = Math.floor(Math.random() * proxyUrls.length)\n\n    return proxyUrls[randomIndex]\n}\n\nconst client = new AxiosClient({ proxyUrl: randomProxyUrl })\n```\n\n## 🤝 Contributing\n\n- Want to contribute? Follow these steps:\n- Fork the repository.\n- Create a new branch (git checkout -b feature-new).\n- Commit your changes (git commit -m 'Add new feature').\n- Push to the branch (git push origin feature-new).\n- Open a Pull Request.\n\n## 📝 License\n\nThis project is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcrap-dev%2Faxios-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcrap-dev%2Faxios-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcrap-dev%2Faxios-client/lists"}