Hello, World!

難しいことは書けません

Perlお茶会 #2

今回は前回の復習も踏まえてGET, HTML::TreeBuilder, Net::Twitterを使ってTwitterで猫のGIF画像を投稿とツイートの仕方を教えてもらったので忘れないうちに軽くメモ

GET, HTML::TreeBuilder, Net::Twitterを使う

インストールしておくもの

ターミナルでNet::Twitterを使えるようにするため以下のコマンドを入力

cpanm IO::Socket::SSL
brew link openssl --force
cpanm Net::Twitter
cpanm HTML::TreeBuilder
twitterの設定

次に、https://apps.twitter.com/にアクセスしてCreate New Appをクリック
Name, Description, Website を入力してWebsiteはhttp://google.comでもいいかな
f:id:eeko-amaryllis:20160325200852p:plain:w600

Yes, I agree をチェックして、Create your Twitter application をクリックしたら以下のようなページにうつる
f:id:eeko-amaryllis:20160325203634p:plain:w600

今回 consumer_key , consumer_secret , access_token , access_token_secret のこの4つが必要なので最初の2つはKeys and Access Tokensのとこに書かれてる
f:id:eeko-amaryllis:20160325210310p:plain:w600

残りの2つはページの1番下にCreate my access tokenってあるのでそれをクリック
f:id:eeko-amaryllis:20160325205749p:plain:w600

するとaccess_token , access_token_secretがわかる
f:id:eeko-amaryllis:20160325232112p:plain:w600

これら4つを記入すればok

実行することで
f:id:eeko-amaryllis:20160325230456p:plain:w500
こんな感じで投稿することができる!

Twitterにgif画像を投稿してみよう

ここのサイトhttp://thecatapi.com/docs.htmlにアクセスして、Have one instantly emailed to you now.をクリック
f:id:eeko-amaryllis:20160325230902p:plain:w600
ここにEmail,Your name,App Descriptionを記入、そしたらAPI keyがわかる
f:id:eeko-amaryllis:20160325231603p:plain:w600

できた
f:id:eeko-amaryllis:20160325232749p:plain:w500