xkcd
v1.1.3
Published
A simple xkcd API
Downloads
73
Readme
xkcd
A simple xkcd API.
download from npm
npm: xkcd
npm install xkcd --save
examples
var xkcd = require('xkcd');
// Get the current xkcd
xkcd(function (data) {
console.log(data);
});
// Get a specific xkcd
xkcd(532, function (data) {
console.log(data);
});
response data example
{
month: "5",
num: 1369,
link: "",
year: "2014",
news: "",
safe_title: "TMI",
transcript: "",
alt: "'TMI' he whispered, gazing into the sea.",
img: "http://imgs.xkcd.com/comics/tmi.png",
title: "TMI",
day: "16"
}
fields
alt
(String) Img alt textday
(String) The day # as a stringimg
(URL) Img URLlink
(String) External links (may be empty)month
(String) Month number as a stringnews
(String) Newsnum
(int) Idsafe_title
(String) Safe titletitle
(String) Titletranscript
(String) Transcriptyear
(String) Year
command line
This module can also be installed as a command line utility.
Global Installation
npm install -g xkcd
Usage
Usage: xkcd <command>
xkcd open latest xkcd
xkcd latest open latest xkcd
xkcd <num> open xkcd by number
xkcd help display this page
notes
- xkcd 404 throws an error since there is no comic for this id.