Marvel のキャラクター名を指定したらイメージ画像が返ってくるっていう簡単なスクリプトを自分で書いたんだけど(クローリングで),いろいろ調べてたら Marvel Comics API っていう API を発見して,マジで Marvel 神じゃん!ってなってた.
Marvelite を使ってイメージ画像を取得してみた
Marvel Comics API をラップした Marvelite っていう Gem があったので使ってみた.
スクリプトは以下に置いてある.簡単に画像 URL を取得できた(画像サイズは standard_amazing
に固定している).
http://i.annihil.us/u/prod/marvel/i/mg/9/c0/527bb7b37ff55/standard_amazing.jpg
Marvel Comics API メモ
- API Key を取得する
- API の動作確認をする
- INTERACTIVE API TESTER 超便利!
- Marvel Developer Portal - Interactive Documentation
- 画像サイズに関して
- 18種類から選べてスゲェ!
- Images in the Marvel Comics API
キャラクターに対する愛を感じる!
Marvel comics are famous for their iconic images, and we have provided a number of options for developers in order to optimally present images to your application's users.
画像 URL は path
と extension
に加えて任意の画像サイズ名を結合して自分で作る必要があるので注意!
The Marvel Comics API does not provide full paths to images. Instead, images are represented as a partial path to an image file and the canonical extension of that file.
API を発見する前に作ったボツ作
Mechanize でキャラクターページまで辿って画像 URL を取得する感じの実装にした.
http://i.annihil.us/u/prod/marvel/i/mg/6/a0/55b6a25e654e6/standard_xlarge.jpg
ハッカソン中のエントリー
会社の同僚と伊東に温泉ハッカソンをしにきてる!
ハッシュタグは #yukemurithon で!