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                                                                                                        ...
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     ...
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...
Twitter                              REST API  •             100  • 20  •Timeline           http://api.twitter.com/statuse...
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=#tw...
Query query = new Query(term); query.rpp(100);do { QueryResult qr = twitter.search(query); tweets = qr.getTweets(); for (T...
APICopyright(c) Yusuke Yamamoto All rights reserved.
API•                      DM•    •                                   REST API•    •           HTTP    •    •   comet      ...
$ wget --output-document=- --user=*** --password=*** https://stream.twitter.com/1/statuses/sample.json                    ...
API• Streamed Tweets •• User Stream •• Site Stream •          Copyright(c) Yusuke Yamamoto All rights reserved.
sample•                                                                    1%•                                  (GET)‣   h...
sample•    •        ‣        ‣        ‣            •                Copyright(c) Yusuke Yamamoto All rights reserved.
FAQ• sample.json •                                                              %                Copyright(c) Yusuke Yamam...
filter • •                                 (POST)‣   https://stream.twitter.com/1/statuses/filter.json •‣ follow, track, loc...
User Stream••        :    •                                        DM fav / follow    •    •   OAuth( or XAuth)           ...
Site Stream(beta)••       : Twitter    •                                        DM fav / follow    •    •   OAuth         ...
Site Stream•                                                                100    •       OAuth•    •   1                ...
• Site Stream        {"control": {           "control_uri":"/2b/site/c/1_1_54e345d655ee3e8d"        }}   • REST  https://s...
•    •                                                               REST        API   Streaming API• gzip    ••    •   3G...
FAQ•                               API JavaScript    •• 1%    •   http://gnip.com/• firehose    •                     Copyr...
Web                                                       API      Copyright(c) Yusuke Yamamoto All rights reserved.
Web Intents •                      Twitter<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></sc...
@Anywhere• JavaScript                                                       Twitter               Copyright(c) Yusuke Yama...
@Anywhere@yusukey<script type="text/javascript">   twttr.anywhere(function (T) {     T.hovercards({expanded:true});     })...
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/discussi...
@twj_dev@twitterapi Copyright(c) Yusuke Yamamoto All rights reserved.
Twitter API•        http://amzn.to/iUeXjm             Copyright(c) Yusuke Yamamoto All rights reserved.   44
Upcoming SlideShare
Loading in...5
×

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

3,338

Published on

Published in: Technology, Education
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,338
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
28
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

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

  1. 1. Twitter API 2012/01/28 Twitter4J - Copyright(c) Yusuke Yamamoto All rights reserved.
  2. 2. @yusukey Copyright(c) Yusuke Yamamoto All rights reserved.
  3. 3. Java Twitter API
  4. 4. Twitter API Copyright(c) Yusuke Yamamoto All rights reserved.
  5. 5. 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
  6. 6. Twitter API Copyright(c) Yusuke Yamamoto All rights reserved.
  7. 7. Twitter API•• OAuth• Copyright(c) Yusuke Yamamoto All rights reserved.
  8. 8. • Twitter•• Copyright(c) Yusuke Yamamoto All rights reserved.
  9. 9. • https://dev.twitter.com/apps/new Copyright(c) Yusuke Yamamoto All rights reserved.
  10. 10. Application Type : Copyright(c) Yusuke Yamamoto All rights reserved.
  11. 11. Read, Write, & Read & Write Read only Access direct messages ○ ○ ○ ○ ○ × ○ ○ × ○ × ×Copyright(c) Yusuke Yamamoto All rights reserved.
  12. 12. OAuthCopyright(c) Yusuke Yamamoto All rights reserved.
  13. 13. Sign in with Twitter Copyright(c) Yusuke Yamamoto All rights reserved.
  14. 14. XAuthCopyright(c) Yusuke Yamamoto All rights reserved.
  15. 15. REST APICopyright(c) Yusuke Yamamoto All rights reserved.
  16. 16. 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
  17. 17. 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.
  18. 18. APICopyright(c) Yusuke Yamamoto All rights reserved.
  19. 19. API• ‣• https://twitter.com/#!/search-home Copyright(c) Yusuke Yamamoto All rights reserved. 19
  20. 20. 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
  21. 21. 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
  22. 22. APICopyright(c) Yusuke Yamamoto All rights reserved.
  23. 23. API• DM• • REST API• • HTTP • • comet WebSocket Copyright(c) Yusuke Yamamoto All rights reserved.
  24. 24. $ wget --output-document=- --user=*** --password=*** https://stream.twitter.com/1/statuses/sample.json Copyright(c) Yusuke Yamamoto All rights reserved.
  25. 25. API• Streamed Tweets •• User Stream •• Site Stream • Copyright(c) Yusuke Yamamoto All rights reserved.
  26. 26. sample• 1%• (GET)‣ https://stream.twitter.com/1/statuses/sample.json•‣•‣ status json (REST API ) Copyright(c) Yusuke Yamamoto All rights reserved.
  27. 27. sample• • ‣ ‣ ‣ • Copyright(c) Yusuke Yamamoto All rights reserved.
  28. 28. FAQ• sample.json • % Copyright(c) Yusuke Yamamoto All rights reserved.
  29. 29. filter • • (POST)‣ https://stream.twitter.com/1/statuses/filter.json •‣ follow, track, locations •‣ status json (REST API ) Copyright(c) Yusuke Yamamoto All rights reserved.
  30. 30. User Stream•• : • DM fav / follow • • OAuth( or XAuth) Copyright(c) Yusuke Yamamoto All rights reserved.
  31. 31. Site Stream(beta)•• : Twitter • DM fav / follow • • OAuth Copyright(c) Yusuke Yamamoto All rights reserved.
  32. 32. Site Stream• 100 • OAuth• • 1 1000 Copyright(c) Yusuke Yamamoto All rights reserved.
  33. 33. • 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.
  34. 34. • • REST API Streaming API• gzip •• • 3G Copyright(c) Yusuke Yamamoto All rights reserved.
  35. 35. FAQ• API JavaScript •• 1% • http://gnip.com/• firehose • Copyright(c) Yusuke Yamamoto All rights reserved.
  36. 36. Web API Copyright(c) Yusuke Yamamoto All rights reserved.
  37. 37. 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.
  38. 38. @Anywhere• JavaScript Twitter Copyright(c) Yusuke Yamamoto All rights reserved.
  39. 39. @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.
  40. 40. Twitter Copyright(c) Yusuke Yamamoto All rights reserved.
  41. 41. Copyright(c) Yusuke Yamamoto All rights reserved.
  42. 42. • 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.
  43. 43. @twj_dev@twitterapi Copyright(c) Yusuke Yamamoto All rights reserved.
  44. 44. Twitter API• http://amzn.to/iUeXjm Copyright(c) Yusuke Yamamoto All rights reserved. 44
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×