Twitterのプロフィールアイコンを1行で取得するGroovyスクリプト

【Dandeon】Twitterアイコンfollow meのカフス(カフリンクス/カフスボタン)

tweetimag.es

  • 取得URL
http://img.tweetimag.es/i/{username}_m
http://img.tweetimag.es/i/{username}_n
http://img.tweetimag.es/i/{username}_b
http://img.tweetimag.es/i/{username}_o

http://img.tweetimag.es/i/orange_clover_n

new File("orange_clover.png") |< new URL("http://img.tweetimag.es/i/orange_clover_n").openStream()


サービス終了?

gadgtwit

  • 取得URL
http://gadgtwit.appspot.com/twicon/{username}
http://gadgtwit.appspot.com/twicon/{username}/mini
http://gadgtwit.appspot.com/twicon/{username}/normal
http://gadgtwit.appspot.com/twicon/{username}/bigger
http://gadgtwit.appspot.com/twicon/{username}/original

http://gadgtwit.appspot.com/twicon/orange_clover

new File("orange_clover.png") |< new URL("http://gadgtwit.appspot.com/twicon/orange_clover").openStream()

usericons

  • 取得URL
http://usericons.relucks.org/twitter/{username}

http://usericons.relucks.org/twitter/orange_clover


以下のサービスのアイコンも習得可能

http://usericons.relucks.org/ を参照

new File("orange_clover.png") |< new URL("http://usericons.relucks.org/twitter/orange_clover").openStream()

dankogai

  • 取得URL
http://api.dan.co.jp/twicon/{username}/mini
http://api.dan.co.jp/twicon/{username}/normal
http://api.dan.co.jp/twicon/{username}/bigger

http://api.dan.co.jp/twicon/orange_clover/normal

new File("orange_clover.png") |< new URL("http://api.dan.co.jp/twicon/orange_clover/normal").openStream()

twicon

  • 取得URL
http://www6.atpages.jp/mgngmgng/twicon?id={username}
http://www6.atpages.jp/mgngmgng/twicon?id={username}&size=mini
http://www6.atpages.jp/mgngmgng/twicon?id={username}&size=normal
http://www6.atpages.jp/mgngmgng/twicon?id={username}&size=biggrer
http://www6.atpages.jp/mgngmgng/twicon?id={username}&size=org

http://www6.atpages.jp/mgngmgng/twicon?id=orange_clover&size=normal

new File("orange_clover.png") |< new URL("http://www6.atpages.jp/mgngmgng/twicon?id=orange_clover&amp;size").openStream()

Twitter4J + Groovyでダウンロード

This method should only be used by application developers to lookup or check the profile image URL for a user.
This method must not be used as the image source URL presented to users of your application.

永続的に表示しなきゃいいんだよね?違うか?
問題あれば削除します。

@Grab('org.twitter4j:twitter4j-core:[2.2.4,)')
import twitter4j.*
    new File("orange_clover.png") |< new URL(new TwitterFactory().getInstance().getProfileImage("orange_clover", ProfileImage.NORMAL).URL).openStream()


ダウンロードしたものをはてなフォトにアップロードしてます


あれ、3行だったね

高田純次 適当人生 ~地球の変な歩き方~ [DVD]










今日からGroovyを始めるための4つのステップ




関谷 和愛、上原 潤二、須江 信洋、中野 靖治
価格: ¥ 3,360
価格は記載時点のものです。購入前にAmazonでご確認ください。


「プログラミングGROOVY」正誤表