This is a fork of the marvel-characters project. On my team we use marvel character names for each of the different test clusters we create. This extends the original project by exporting more than just the character names.
The characters.json
contains the following information from the marvel API:
- Id
- Name
- Description
- Thumbnail
- Links
- Short Name - Shorter, unique name suitable for a generated hostname. Has the following rules:
- Strip off the variation of a character (in the API as NAME (VARIATION) )
- Replace any whitespace with '-'
- Remove any non-word characters
- Restrict the length to 22 characters
Characters that result in the same short name are removed from the list so there are not duplicates. Characters with no thumbnail image are also removed.
A list of all public comic book character names in the Marvel universe, sourced from the API.
Total Characters: 799 Last Updated: Friday, January 13th, 2017.
Data provided by Marvel. © 2017 Marvel
npm install marvel-characters [--g|--save]
var marvel = require('marvel-characters')
// random character
console.log(marvel())
//=> 'Iron Man'
// all characters
console.log(marvel.characterNames)
//=> ["3-D Man", "A-Bomb", ..., "Zuras", "Zzzax"]
// character information
console.log(marvel.character('iron-man'))
Returns a random Marvel character name, like "Spider-Man"
.
The array of all character names.
The json information for a single character.
The required JSON array.
You can also use the CLI here.
Usage:
marvel-characters [opt]
Options:
--help show help
--all list all characters
Example:
$ marvel-characters
Green Goblin
Clone & install:
git clone https://github.com/chrisdail/marvel-characters.git
cd marvel-characters
npm install
You will need a Marvel Developer account. Once you have API keys, copy them into a .marvel-charactersrc
file in the same directory. It should look like this, with your keys:
{
"privateKey": "egadg545151232d02ea0b9asdfasdfd5699a",
"publicKey": "badsg1cbadsggagafdh0"
}
Then use npm start
to scrape the new data.
MIT, see LICENSE.md for details.