To Tweet more than 140 charcters
http://www.twitlonger.com
To Tweet URL
http://bit.ly/
http://tinyurl.com/
http://twitpwr.com/
http://www.urltwit.com/
To Tweet Image/Video
http://twitpic.com/
http://yfrog.com/
http://plixi.com
http://www.twitvid.com/
http://twitgoo.com/
To Tweet Audio[Songs...]
http://twitlens.com/
http://tweetmic.com/
http://twt.fm/
To Update the Background of Tweet Page
http://twitrounds.com/
http://www.twitrbackgrounds.com/
To Increase the Twitter Followers
http://www.tweetwhistle.com/
Pages
Showing posts with label Twitter. Show all posts
Showing posts with label Twitter. Show all posts
Saturday, December 18, 2010
Sunday, July 4, 2010
Twitter API
Twitter4J is a Java library for the Twitter API.
With Twitter4J, We can easily integrate our Java application with the Twitter service.
Step-up Twitter4j API
Get the Consumer key \ API key & Consumer Secret \Secret Key.
To start your work with Twitter4j API, You need to get the
Consumer key \ API key & Consumer Secret \Secret Key.
You need to get register your applications in this page http://twitter.com/apps
using Twitter account.
Download Twitter4j jar
Download - twitter4j-core-2.1.3-SNAPSHOT.jar
Inlcuded the jar in the class path and try to access the class in the jar
We can start coding the application now.
Create the Twitter object & get the request token by passing the application Consumer key & secret.
Code
Get the Access Token & Secret
By using the request token you need to get the access token & token secret.
Code
Authorized URL for accessing the Application
Store the requestToken & Authorized URl in a session.
Example Authorized Application URL
https://twitter.com/oauth/authorize?auth_token=LJyavdddrrrreddddy3sfpm8bTHg3H3Bddddm4
Once you click the authorized link it will ask for you twitter username & password.Once user details verfied it redirect to your application.
Functions in Twitter4j
Tweet Message
This function is to tweet a text message in his/her twitter.
Delete the Tweeted message
We can delete the tweeted message by passing the TweetId
User details
This function is used to get the user details.We need to pass the user’s id .
From the user object we can get the details of the user profile,description …
Search Tweet
We can search for tweets by using this method
To get the friends tweets & details
/* All the Tweets in the first page will be displayed*/
/** Four tweets in the first page will be displayed*/
Sending / Receiving Direct Messages
Method's avaialabe in the Twitter API
http://apiwiki.twitter.com/Twitter-API-Documentation
With Twitter4J, We can easily integrate our Java application with the Twitter service.
Step-up Twitter4j API
Get the Consumer key \ API key & Consumer Secret \Secret Key.
To start your work with Twitter4j API, You need to get the
Consumer key \ API key & Consumer Secret \Secret Key.
You need to get register your applications in this page http://twitter.com/apps
using Twitter account.
Download Twitter4j jar
Download - twitter4j-core-2.1.3-SNAPSHOT.jar
Inlcuded the jar in the class path and try to access the class in the jar
We can start coding the application now.
Create the Twitter object & get the request token by passing the application Consumer key & secret.
Code
Twitter twitter = new Twitter();
twitter.setOAuthConsumer("consumer key",”consumer secret” );
RequestToken requestToken = twitter.getOAuthRequestToken();
Get the Access Token & Secret
By using the request token you need to get the access token & token secret.
Code
String token = requestToken.getToken();
String tokenSecret = requestToken.getTokenSecret();
Authorized URL for accessing the Application
Store the requestToken & Authorized URl in a session.
String authUrl = requestToken.getAuthorizationURL();
session.setAttribute("authUrl", authUrl);
session.setAttribute("requestToken", requestToken);
Example Authorized Application URL
https://twitter.com/oauth/authorize?auth_token=LJyavdddrrrreddddy3sfpm8bTHg3H3Bddddm4
Once you click the authorized link it will ask for you twitter username & password.Once user details verfied it redirect to your application.
Functions in Twitter4j
Tweet Message
This function is to tweet a text message in his/her twitter.
Status status = twitter.updateStatus(“Tweet Message .”);
Delete the Tweeted message
We can delete the tweeted message by passing the TweetId
destroyTweet(twitter,tweetId);
User details
This function is used to get the user details.We need to pass the user’s id .
User user = twitter.showUser(twitter.getId());
From the user object we can get the details of the user profile,description …
user.getProfileImageURL();
user.getScreenName();
user.getName();
user.getDescription();
user.getURL();
user.getLocation();
user.getProfileBackgroundColor();
user.getProfileBackgroundImageUrl();
Search Tweet
We can search for tweets by using this method
String searchTweet ="TieCon MidWest"
Query query = new Query("searchTweet");
QueryResult result = twitter.search(query);
System.out.println("hits:" + result.getTotal());
for (Tweet tweet : result.getTweets()) {
System.out.println(tweet.getFromUser() + ":" + tweet.getText());
}
To get the friends tweets & details
/* All the Tweets in the first page will be displayed*/
Liststatuses = twitter.getFriendsTimeline();
for (Status status : statuses) {
System.out.println(status.getUser().getName() + ":" +
status.getText());
}
/** Four tweets in the first page will be displayed*/
Paging paging = new Paging(1, 4);
Liststatuses = twitter.getFriendsTimeline(paging);
Sending / Receiving Direct Messages
Twitter sender= new TwitterFactory().getInstance(senderID,senderPassword);
sender.sendDirectMessage(recipientId,message);
Twitter receiver = new TwitterFactory().getInstance(recipientId,recipientPassword);
Listmessages = receiver.getDirectMessages();
for (DirectMessage message : messages) {
System.out.println("Sender:" + message.getSenderScreenName());
System.out.println("Text:" + message.getText());
}
Method's avaialabe in the Twitter API
http://apiwiki.twitter.com/Twitter-API-Documentation
Labels:
Twitter,
Twitter Java API,
TwitterAPI
Subscribe to:
Posts (Atom)