Twitter 研究会2012-1-28 - Twitter APIの紹介
Upcoming SlideShare
Loading in...5
×
 

Twitter 研究会2012-1-28 - Twitter APIの紹介

on

  • 3,737 views

 

Statistics

Views

Total Views
3,737
Views on SlideShare
3,714
Embed Views
23

Actions

Likes
7
Downloads
27
Comments
0

4 Embeds 23

https://twitter.com 10
http://a0.twimg.com 6
http://us-w1.rockmelt.com 5
http://tweetedtimes.com 2

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Twitter 研究会2012-1-28 - Twitter APIの紹介 Twitter 研究会2012-1-28 - Twitter APIの紹介 Presentation Transcript

  • Twitter API 2012/01/28 Twitter4J - Copyright(c) Yusuke Yamamoto All rights reserved.
  • @yusukey Copyright(c) Yusuke Yamamoto All rights reserved.
  • Java Twitter API
  • Twitter API Copyright(c) Yusuke Yamamoto All rights reserved.
  • Twi$erAPI RESTAPI : API :Java,Objec8ve9C API StreamedTweets , Java,Python,PHP,Ruby,Objec8ve9C Web API WebIntents :Web @Anywhere :HTML,JavaScript Copyright(c) Yusuke Yamamoto All rights reserved. 5
  • Twitter API Copyright(c) Yusuke Yamamoto All rights reserved.
  • Twitter API•• OAuth• Copyright(c) Yusuke Yamamoto All rights reserved.
  • • Twitter•• Copyright(c) Yusuke Yamamoto All rights reserved.
  • • https://dev.twitter.com/apps/new Copyright(c) Yusuke Yamamoto All rights reserved.
  • Application Type : Copyright(c) Yusuke Yamamoto All rights reserved.
  • Read, Write, & Read & Write Read only Access direct messages ○ ○ ○ ○ ○ × ○ ○ × ○ × ×Copyright(c) Yusuke Yamamoto All rights reserved.
  • OAuthCopyright(c) Yusuke Yamamoto All rights reserved.
  • Sign in with Twitter Copyright(c) Yusuke Yamamoto All rights reserved.
  • XAuthCopyright(c) Yusuke Yamamoto All rights reserved.
  • REST APICopyright(c) Yusuke Yamamoto All rights reserved.
  • REST API • REST: REpresentational State Transfer • HTTP APIGET /1/statuses/public_timeline.json HTTP/1.1Host: api.twitter.comHTTP/1.1 200 OKDate: Tue, 08 Feb 2011 07:52:51 GMTServer: hiStatus: 200 OKContent-Type: application/json; charset=utf-8Vary: Accept-EncodingConnection: close[{"source": "<a href="http://foursquare.com" rel="nofollow">foursquare</a>", "text": "Im at IKEA ( 2-2-2, ) [pic]: http://4sq.com/eOHZdS", ... "user": { "description": "Java rn Java rn#twitter4j#samurai", "name": " ", ...} }, ...] Copyright(c) Yusuke Yamamoto All rights reserved. 16
  • Twitter REST API • 100 • 20 •Timeline http://api.twitter.com/statuses/***.jsonUser http://api.twitter.com/users/***.jsonDirect message http://api.twitter.com/direct_messages/***.json Copyright(c) Yusuke Yamamoto All rights reserved.
  • APICopyright(c) Yusuke Yamamoto All rights reserved.
  • API• ‣• https://twitter.com/#!/search-home Copyright(c) Yusuke Yamamoto All rights reserved. 19
  • API• (GET)‣ http://search.twitter.com/search.json?q=****•q q: #twtr_hack q=#twtr_hack @yusukey #twtr_hack q=#twtr_hack+from:yusukey Copyright(c) Yusuke Yamamoto All rights reserved. 20
  • Query query = new Query(term); query.rpp(100);do { QueryResult qr = twitter.search(query); tweets = qr.getTweets(); for (Tweet tweet : tweets) { // ... } if (tweets.size() != 0) { query.setMaxId(tweets.get(tweets.size() - 1).getId() - 1); }} while (tweets.size() != 0); rpp 100 page 15 1500 →max_id ok Twitter4J Copyright(c) Yusuke Yamamoto All rights reserved. 21
  • APICopyright(c) Yusuke Yamamoto All rights reserved.
  • API• DM• • REST API• • HTTP • • comet WebSocket Copyright(c) Yusuke Yamamoto All rights reserved.
  • $ wget --output-document=- --user=*** --password=*** https://stream.twitter.com/1/statuses/sample.json Copyright(c) Yusuke Yamamoto All rights reserved.
  • API• Streamed Tweets •• User Stream •• Site Stream • Copyright(c) Yusuke Yamamoto All rights reserved.
  • sample• 1%• (GET)‣ https://stream.twitter.com/1/statuses/sample.json•‣•‣ status json (REST API ) Copyright(c) Yusuke Yamamoto All rights reserved.
  • sample• • ‣ ‣ ‣ • Copyright(c) Yusuke Yamamoto All rights reserved.
  • FAQ• sample.json • % Copyright(c) Yusuke Yamamoto All rights reserved.
  • filter • • (POST)‣ https://stream.twitter.com/1/statuses/filter.json •‣ follow, track, locations •‣ status json (REST API ) Copyright(c) Yusuke Yamamoto All rights reserved.
  • User Stream•• : • DM fav / follow • • OAuth( or XAuth) Copyright(c) Yusuke Yamamoto All rights reserved.
  • Site Stream(beta)•• : Twitter • DM fav / follow • • OAuth Copyright(c) Yusuke Yamamoto All rights reserved.
  • Site Stream• 100 • OAuth• • 1 1000 Copyright(c) Yusuke Yamamoto All rights reserved.
  • • Site Stream {"control": { "control_uri":"/2b/site/c/1_1_54e345d655ee3e8d" }} • REST https://sitestream.twitter.com/2b/site/c/1_1_54e345d655ee3e8d"https://dev.twitter.com/docs/streaming-api/control-streams Copyright(c) Yusuke Yamamoto All rights reserved.
  • • • REST API Streaming API• gzip •• • 3G Copyright(c) Yusuke Yamamoto All rights reserved.
  • FAQ• API JavaScript •• 1% • http://gnip.com/• firehose • Copyright(c) Yusuke Yamamoto All rights reserved.
  • Web API Copyright(c) Yusuke Yamamoto All rights reserved.
  • Web Intents • Twitter<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><a href="http://twitter.com/intent/retweet?tweet_id=163049746431348736"> </a> http://bit.ly/web-intents Copyright(c) Yusuke Yamamoto All rights reserved.
  • @Anywhere• JavaScript Twitter Copyright(c) Yusuke Yamamoto All rights reserved.
  • @Anywhere@yusukey<script type="text/javascript"> twttr.anywhere(function (T) { T.hovercards({expanded:true}); });</script> http://bit.ly/hover-cards Copyright(c) Yusuke Yamamoto All rights reserved.
  • Twitter Copyright(c) Yusuke Yamamoto All rights reserved.
  • Copyright(c) Yusuke Yamamoto All rights reserved.
  • • Twitter development talk-ja http://bit.ly/tdt-ja• dev.twitter.com - Discussions https://dev.twitter.com/discussions Copyright(c) Yusuke Yamamoto All rights reserved.
  • @twj_dev@twitterapi Copyright(c) Yusuke Yamamoto All rights reserved.
  • Twitter API• http://amzn.to/iUeXjm Copyright(c) Yusuke Yamamoto All rights reserved. 44