{"id":50337435,"url":"https://github.com/xcrap-dev/api","last_synced_at":"2026-05-29T14:31:32.326Z","repository":{"id":305578078,"uuid":"1023254473","full_name":"xcrap-dev/api","owner":"xcrap-dev","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-06T11:46:23.000Z","size":610,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-12T14:52:27.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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-07-20T21:11:15.000Z","updated_at":"2026-02-27T06:13:40.000Z","dependencies_parsed_at":"2025-07-20T23:26:18.203Z","dependency_job_id":"3ee4cf8e-1b2c-4f97-b78b-939d3e631c14","html_url":"https://github.com/xcrap-dev/api","commit_stats":null,"previous_names":["xcrap-cloud/api","xcrap-dev/api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xcrap-dev/api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Fapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Fapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Fapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Fapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xcrap-dev","download_url":"https://codeload.github.com/xcrap-dev/api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xcrap-dev%2Fapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33657690,"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-29T02:00:06.066Z","response_time":107,"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":[],"created_at":"2026-05-29T14:31:31.124Z","updated_at":"2026-05-29T14:31:32.321Z","avatar_url":"https://github.com/xcrap-dev.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/marcuth"],"categories":[],"sub_categories":[],"readme":"# 🕷️ Xcrap API Client\n\n**Xcrap API Client** is a package for the [Xcrap Cloud](https://xcrap.cloud) service, designed for communicating with the API and handling authentication, management, and execution of scrapers and clients.\n\n## 📦 Installation\n\nInstallation is straightforward. Just use your preferred dependency manager. Here is an example using NPM:\n\n```cmd\nnpm i @xcrap/api\n```\n\n## 🚀 Usage\n\nIf you're using a different server based on Xcrap Cloud (yes, we're open source), change the `baseUrl` in the `Xcrap` constructor.\n\n\u003ca href=\"https://www.buymeacoffee.com/marcuth\"\u003e\n  \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" width=\"200\"\u003e\n\u003c/a\u003e\n\n### Authentication\n\nTo access the routes, you must first authenticate. There are two ways to do this: using an email and password to get access tokens or using API Keys.\n\n**Using email and password:**\n\n```ts\nimport { Xcrap, AuthService } from \"@xcrap/api\"\n\n;(async () =\u003e {\n\tconst auth = new AuthService()\n\n\tconst tokens = await auth.signIn({\n\t\temail: \"YOUR_EMAIL\",\n\t\tpassword: \"YOUR_PASSWORD\"\n\t})\n\t\n\tconst xcrap = new Xcrap(tokens)\n})();\n```\n\n**Using API Keys:**\n\n```ts\nimport { Xcrap } from \"@xcrap/api\"\n\nconst xcrap = new Xcrap({ apiKey: \"YOUR_API_KEY\" })\n```\n\n-----\n\n### Clients\n\n#### Creating a Client\n\n```ts\nimport { Xcrap, ClientType } from \"@xcrap/api\"\n\n;(async () =\u003e {\n\t// Your way of instantiating Xcrap\n\n\tconst client = await xcrap.clients.create({\n\t\tname: \"A Cool Client\",\n\t\tdescription: \"A description for my Cool Client.\", // optional\n\t\ttype: ClientType.Axios // Check if the type is actually available for the pointed server\n\t})\n\n\tconsole.log(client) // Displays a class called Client that has the following methods: update, delete\n})();\n```\n\n#### Finding a Client\n\n```ts\nconst client = await xcrap.clients.findOne(\"YOUR_CLIENT_ID\")\n```\n\n#### Finding Multiple Clients\n\n```ts\nconst clients = await xcrap.clients.findMany()\n```\n\nYou can also paginate. The default and maximum amount of results will depend on the targeted server, but you can define it explicitly:\n\n```ts\nconst clients1 = await xcrap.clients.findMany({ page: 1, perPage: 20 })\nconst clients2 = await xcrap.clients.findMany({ page: 2, perPage: 20 })\n```\n\n#### Updating a Client\n\n```ts\nconst updatedClient = await xcrap.clients.update(\"YOUR_CLIENT_ID\", {\n\tname: \"Updated Cool Client\",\n\tdescription: \"A updated description for my Cool Client.\",\n\ttype: \"got_scraping\" // Again, check if the type is available for the pointed server\n})\n```\n\n**Using a Client object:**\n\n```ts\nawait client.update({\n\tname: \"Updated Cool Client\",\n\tdescription: \"A updated description for my Cool Client.\",\n\ttype: \"got_scraping\" // Again, check if the type is available for the pointed server\n})\n```\n\n#### Deleting a Client\n\n```ts\nawait xcrap.clients.delete(\"YOUR_CLIENT_ID\")\n```\n\n**Using a Client object:**\n\n```ts\nawait client.delete()\n```\n\n-----\n\n### Scrapers\n\n#### Creating a Scraper\n\n```ts\nimport { Xcrap, ParsingModelFieldType } from \"@xcrap/api\"\n\n;(async () =\u003e {\n\t// Your way of instantiating Xcrap\n\n\tconst scraper = await xcrap.scrapers.create({\n\t\tname: \"A Cool Scraper\",\n\t\tdescription: \"A description for my Cool Scraper\", // optional\n\t\tdefaultUrl: \"http://example.com\", // optional\n\t\tclientId: \"YOUR_CLIENT_ID\",\n\t\tparsingModel: {\n\t\t\ttype: ParsingModelFieldType.Html, // Check if the type is available for the pointed server\n\t\t\tmodel: {\n\t\t\t\ttitle: {\n\t\t\t\t\tquery: \"title\",\n\t\t\t\t\textractor: \"text\" // Check if the extractor is available for the pointed server\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\tquery: \"title\",\n\t\t\t\t\textractor: \"attribute:content\" // Again, check if the extractor is available for the pointed server\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\tconsole.log(scraper) // Displays a class called Scraper that has the following methods: update, delete, execute\n})();\n```\n\n#### Finding a Scraper\n\n```ts\nconst scraper = await xcrap.scrapers.findOne(\"YOUR_SCRAPER_ID\")\n```\n\n#### Executing a Scraper\n\n```ts\nconst { data, metadata } = await xcrap.scrapers.executeOne(\"YOUR_SCRAPER_ID\")\n```\n\n**Using a Scraper object:**\n\n```ts\nconst { data, metadata } = await scraper.execute()\n```\n\n#### Executing a Dynamic Scraper\n\nTo be clear, a dynamic scraper is a scraper that isn't registered in the database; it's created dynamically in real-time. You can also create a Client with it or just pass the ID of an existing one.\n\n**Using an existing Client:**\n\n```ts\nconst { data, metadata } = await xcrap.scrapers.executeOneDynamic({\n\turl: \"http://example.com\",\n\tclientId: \"YOUR_CLIENT_ID\",\n\tparsingModel: {\n\t\ttype: ParsingModelFieldType.Html, // Check if the type is available for the pointed server\n\t\tmodel: {\n\t\t\ttitle: {\n\t\t\t\tquery: \"title\",\n\t\t\t\textractor: \"text\" // Check if the extractor is available for the pointed server\n\t\t\t},\n\t\t\ttitle: {\n\t\t\t\tquery: \"title\",\n\t\t\t\textractor: \"attribute:content\" // Again, check if the extractor is available for the pointed server\n\t\t\t}\n\t\t}\n\t}\n})\n```\n\n**Dynamically creating a Client:**\n\n```ts\nconst { data, metadata } = await xcrap.scrapers.executeOneDynamic({\n\turl: \"http://example.com\",\n\tclient: {\n\t\ttype: \"puppeteer_real_browser\" // Check if the type is actually available for the pointed server\n\t},\n\tparsingModel: {\n\t\ttype: ParsingModelFieldType.Html, // Check if the type is available for the pointed server\n\t\tmodel: {\n\t\t\ttitle: {\n\t\t\t\tquery: \"title\",\n\t\t\t\textractor: \"text\" // Check if the extractor is available for the pointed server\n\t\t\t},\n\t\t\ttitle: {\n\t\t\t\tquery: \"title\",\n\t\t\t\textractor: \"attribute:content\" // Again, check if the extractor is available for the pointed server\n\t\t\t}\n\t\t}\n\t}\n})\n```\n\n#### Finding Multiple Scrapers\n\n```ts\nconst scrapers = await xcrap.scrapers.findMany()\n```\n\nYou can also paginate. The default and maximum amount of results will depend on the targeted server, but you can define it explicitly:\n\n```ts\nconst scrapers1 = await xcrap.scrapers.findMany({ page: 1, perPage: 20 })\nconst scrapers2 = await xcrap.scrapers.findMany({ page: 2, perPage: 20 })\n```\n\n#### Updating a Client\n\n```ts\nconst updatedScraper = await xcrap.SCRAPERS.update(\"YOUR_SCAPER_ID\", {\n\tname: \"Updated Cool Scraper\",\n\tdescription: \"A updated description for my Cool Scraper.\",\n\tmodel: {\n\t\ttitle: {\n\t\t\tquery: \"title\",\n\t\t\textractor: \"text\" // Check if the extractor is available for the pointed server\n\t\t},\n\t\ttitle: {\n\t\t\tquery: \"title\",\n\t\t\textractor: \"attribute:content\" // Again, check if the extractor is available for the pointed server\n\t\t},\n\t\theading: {\n\t\t\tquery: \"h1\",\n\t\t\textractor: \"text\"\n\t\t}\n\t}\n})\n```\n\n**Using a Scraper object:**\n\n```ts\nawait scraper.update({\n\tname: \"Updated Cool Scraper\",\n\tdescription: \"A updated description for my Cool Scraper.\",\n\tmodel: {\n\t\ttitle: {\n\t\t\tquery: \"title\",\n\t\t\textractor: \"text\" // Check if the extractor is available for the pointed server\n\t\t},\n\t\ttitle: {\n\t\t\tquery: \"title\",\n\t\t\textractor: \"attribute:content\" // Again, check if the extractor is available for the pointed server\n\t\t},\n\t\theading: {\n\t\t\tquery: \"h1\",\n\t\t\textractor: \"text\"\n\t\t}\n\t}\n})\n```\n\n#### Deleting a Scraper\n\n```ts\nawait xcrap.scrapers.delete(\"YOUR_CLIENT_ID\")\n```\n\n**Using a Client object:**\n\n```ts\nawait scraper.delete()\n```\n\n## 🧪 Tests\n\nAutomated tests are in `__tests__`. To run them:\n\n```bash\nnpm run test\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%2Fapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxcrap-dev%2Fapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxcrap-dev%2Fapi/lists"}