{"id":15588727,"url":"https://github.com/sidhantpanda/xkcd-api","last_synced_at":"2025-07-12T07:05:00.054Z","repository":{"id":10162219,"uuid":"64730811","full_name":"sidhantpanda/xkcd-api","owner":"sidhantpanda","description":"An API wrapper to fetch xkcd comics","archived":false,"fork":false,"pushed_at":"2022-12-09T19:26:26.000Z","size":45,"stargazers_count":11,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-24T05:26:40.969Z","etag":null,"topics":["api","cli","nodejs"],"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/sidhantpanda.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}},"created_at":"2016-08-02T06:34:57.000Z","updated_at":"2022-11-07T19:42:07.000Z","dependencies_parsed_at":"2023-01-13T15:46:36.468Z","dependency_job_id":null,"html_url":"https://github.com/sidhantpanda/xkcd-api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sidhantpanda/xkcd-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidhantpanda%2Fxkcd-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidhantpanda%2Fxkcd-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidhantpanda%2Fxkcd-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidhantpanda%2Fxkcd-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidhantpanda","download_url":"https://codeload.github.com/sidhantpanda/xkcd-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidhantpanda%2Fxkcd-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264952357,"owners_count":23688062,"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":["api","cli","nodejs"],"created_at":"2024-10-02T22:41:36.292Z","updated_at":"2025-07-12T07:05:00.038Z","avatar_url":"https://github.com/sidhantpanda.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xkcd-api\nAn API wrapper and CLI tool to fetch xkcd comics.\n\n```\n$ npx xkcd-api\n```\n\n```\n$ npm install xkcd-api\n```\n\n```javascript\n$ var xkcd = require('xkcd-api');\n```\n\n### APIs available\n* [Get the latest comic](#get_latest)\n* [Get a particular comic](#get_comic)\n* [Get a random comic](#get_random)\n\n### CLI equivalent\n* [Get the latest comic](#get_latest_cli)\n* [Get a particular comic](#get_comic_cli)\n* [Get a random comic](#get_random_cli)\n\n### \u003ca name=\"get_latest\"\u003e\u003c/a\u003eGet the latest comic\n```javascript\nxkcd.latest(function(error, response) {\n  if (error) {\n    console.error(error);\n  } else {\n    console.log(response);\n  }\n});\n```\n\n### \u003ca name=\"get_comic\"\u003e\u003c/a\u003eGet a particular comic\n```javascript\nxkcd.get('comic-id', function(error, response) {\n  if (error) {\n    console.error(error);\n  } else {\n    console.log(response);\n  }\n});\n```\n\n### \u003ca name=\"get_random\"\u003e\u003c/a\u003eGet a random comic\n```javascript\nxkcd.random(function(error, response) {\n  if (error) {\n    console.error(error);\n  } else {\n    console.log(response);\n  }\n});\n```\n\n## CLI Features\nPlease make sure you've installed the package globally or are running it with npx.\n\n### \u003ca name=\"get_latest_cli\"\u003e\u003c/a\u003eGet the latest comic (CLI)\n```\nxkcd-api\nxkcd-api -l\nxkcd-api --latest\n```\n\n### \u003ca name=\"get_comic_cli\"\u003e\u003c/a\u003eGet a particular comic (CLI)\n```\nxkcd-api -n 1714\nxkcd-api --number 1714\n```\n\n### \u003ca name=\"get_random_cli\"\u003e\u003c/a\u003eGet a random comic (CLI)\n```\nxkcd-api -r\nxkcd-api --random\n```\n\n---\n### Contributors\n[Štefan Jarina](https://github.com/stefanjarina)\n\n[justchen1369](https://github.com/justchen1369)\n\n---\n### Submit issues\nYou can raise an issue in this repo or mail me at sidhant@hashexclude.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidhantpanda%2Fxkcd-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidhantpanda%2Fxkcd-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidhantpanda%2Fxkcd-api/lists"}