Skip to content

chrisdail/marvel-characters

 
 

Repository files navigation

marvel-characters

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.

stable

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

Install

npm install marvel-characters [--g|--save]

Example

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'))

Usage

API

name = marvel()

Returns a random Marvel character name, like "Spider-Man".

list = marvel.characterNames

The array of all character names.

character = marvel.character(short-name)

The json information for a single character.

list = require('marvel-characters/characters.json')

The required JSON array.

CLI

You can also use the CLI here.

Usage:
  marvel-characters [opt]
  
Options:
  --help  show help
  --all   list all characters 

Example:

$ marvel-characters
Green Goblin

Running From Source

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.

See Also

License

MIT, see LICENSE.md for details.

About

💥 all Marvel comic book characters

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%