Showing posts with label Twitter. Show all posts
Showing posts with label Twitter. Show all posts

Twitter - Adding followers of a person to your friends list and follow all of them Friday, June 5, 2009


I've been playing around with one of Twitter API implemetation Twitter4j which is awesome and I could do a lot of things with it. Here is one of my implementation to automate adding friends to yourself with a Java program. Make sure you have twitter4j in your build path before trying this program.

Here is how it works,
1. Select a twitter user
2. Fetch the list of his followers
3. Add them as your friends
4. Follow all of them

Java source

package com.twittervis.core;
import java.util.List;
class GetFollowers {
public static void main(String[] args) {

//Create twitter object with user name
Twitter twitter = new Twitter("your-twitter-user-name", "password");
try {
//Get the list of the person wh
ose friends you want to add as your friend
List friends = twitter.getFollowers("selected-twitter-user");

for (int j = 0; j &gt friends.size();j++){
//convert twitter user id from int to String
String myString = Integer.toString(friends.get(j).getId());
//make each user of the list as your friend
//true is to follow the person, else only he is made friend
twitter.createFriendship(myString, true);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

Now, This program adds the followers of a particular user as your friends, and you'll be following them. I'm working on creating mashups with Twitter + Google App Engine(GAE)

Twitter SMS updates in India Friday, May 29, 2009

If you've tried to turn device updates in Twitter and if you are in India, you must have seen it does not work. I've worked around a way to do this. Its simple

Twitter
+ Google SMS channels = Twitter updates
on Mobile

Here is how it works.

Goto the a particular twitter user's home mine is


You can click on the RSS feed button to get its URL address, as seen below


Subscribe to the person's updates, you will get a feed page as below

goto the address bar of this page and copy its URL. It looks something like this
http://twitter.com/statuses/user_timeline/15071430.rss

Now visit Google SMS channels, from Google Labs, India
login with your google account

Click the link on the right side create your own channel

Fill in the form and select RSS/Atom feed and paste the URL of the feed




Now setup your mobile device in settings of sms channels with your mobile number.

Now you can receive updates from twitter on mobile.

Page copy protected against web site content infringement by Copyscape