Created
August 1, 2016 19:35
-
-
Save oluies/41e0d10d5438e196dc14c8dbec5330fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.typesafe.config.ConfigFactory | |
import twitter4j.{RateLimitStatus, TwitterFactory} | |
import twitter4j.conf.ConfigurationBuilder | |
import java.util.{Timer, TimerTask} | |
import scala.collection.JavaConverters._ | |
import scala.collection.mutable | |
object AllListContentFollowers { | |
def main(args : Array[String]): Unit = { | |
val conf = ConfigFactory.load() | |
val cb = new ConfigurationBuilder() | |
cb.setDebugEnabled(true) | |
.setOAuthConsumerKey(conf.getString("twitterConsumerKey")) | |
.setOAuthConsumerSecret(conf.getString("twitterConsumerSecret")) | |
.setOAuthAccessToken(conf.getString("twitterAccessToken")) | |
.setOAuthAccessTokenSecret(conf.getString("twitterAccessTokenSecret")) | |
val tf = new TwitterFactory(cb.build()) | |
val twitter = tf.getInstance() | |
// count=700&owner_screen_name=Europarl_EN&slug=all-meps-on-twitter' | |
// val statuses = twitter.getUserListMembers(ownerScreenName = "Europarl_EN", slug = "all-meps-on-twitter", count = 700, cursor = -1L) | |
val listMembers = twitter.getUserListMembers("Europarl_EN","all-meps-on-twitter", 700,-1L) | |
System.out.println("Processing users .") | |
val it = listMembers.iterator() | |
while (it.hasNext()) { | |
val listMember = it.next() | |
println(listMember.getName() + " count " + listMember.getFollowersCount + " id " + listMember.getId ) | |
val rateLimit: mutable.Map[String, RateLimitStatus] = twitter.getRateLimitStatus.asScala | |
println(rateLimit) | |
val followers = twitter.getFollowersIDs(listMember.getId,-1L) | |
val followersList = List(followers.getIDs.toList) | |
println("followerIDs") | |
println(followersList) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment