kakakakakku blog

Weekly Tech Blog: Keep on Learning!

Marvel Comics API っていう神 API を発見した

Marvel のキャラクター名を指定したらイメージ画像が返ってくるっていう簡単なスクリプトを自分で書いたんだけど(クローリングで),いろいろ調べてたら Marvel Comics API っていう API を発見して,マジで Marvel 神じゃん!ってなってた.

developer.marvel.com

Marvelite を使ってイメージ画像を取得してみた

Marvel Comics API をラップした Marvelite っていう Gem があったので使ってみた.

スクリプトは以下に置いてある.簡単に画像 URL を取得できた(画像サイズは standard_amazing に固定している).

github.com

http://i.annihil.us/u/prod/marvel/i/mg/9/c0/527bb7b37ff55/standard_amazing.jpg

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 は pathextension に加えて任意の画像サイズ名を結合して自分で作る必要があるので注意!

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 を取得する感じの実装にした.

github.com

http://i.annihil.us/u/prod/marvel/i/mg/6/a0/55b6a25e654e6/standard_xlarge.jpg

ハッカソン中のエントリー

会社の同僚と伊東に温泉ハッカソンをしにきてる!

ハッシュタグは #yukemurithon で!

kakakakakku.hatenablog.com