Delete your all friends in twitter.
If you tried to get more followers by following some marketers, makemoney, ebook salers, entrepreneurs, get traffic acounts. You probably messed your twitter acount. (Getting to many tweets, direct messages, replys, retweets.) For a fresh start up in twitter, you can get rid of all of them by this simple script.
Caution: All your following list will be deleted.
require 'rubygems'
require 'twitter'
auth = Twitter::HTTPAuth.new('username', 'password')
base = Twitter::Base.new(auth)
sil_bastan = base.friend_ids
puts "There are #{sil_bastan.size} People you follow"
sil_bastan.each do |user_id|
user = base.friendship_destroy([user_id])
puts "#{user.id} not following anymore"
end
Follow twitter users by keywords
<?php
// Set the twitter user
$user = "";
$pass = "";
// The search term to follow based on (e.g. "soccer")
$term = "";
// Get already followed
$userApiUrl = "http://twitter.com/statuses/friends.json";
$ch = curl_init($userApiUrl);
curl_setopt($ch, CURLOPT_USERPWD
, $user.":".$pass);
curl_setopt($ch, CURLOPT_RETURNTRANSFER
, 1);
$apiresponse = curl_exec($ch);
curl_close($ch);
$followed = array();
if ($apiresponse) {
$json = json_decode($apiresponse);
if ($json != null) {
foreach ($json as $u) {
$followed[] = $u->name;
}
}
}
$userApiUrl = "http://search.twitter.com/search.json?q=" . $term . "&rpp=100";
$ch = curl_init($userApiUrl);
curl_setopt($ch, CURLOPT_USERPWD
, $user.":".$pass);
curl_setopt($ch, CURLOPT_RETURNTRANSFER
, 1);
$apiresponse = curl_exec($ch);
curl_close($ch);
if ($apiresponse) {
$results = json_decode($apiresponse);
$count = 20;
if ($results != null) {
$resultsArr = $results->results;
if (is_array($resultsArr)) {
foreach ($resultsArr as $result) {
$from_user = $result->from_user;
if (!in_array($from_user,$followed)) {
$ch = curl_init("http://twitter.com/friendships/create/" . $from_user . ".json");
curl_setopt($ch, CURLOPT_USERPWD
, $user.":".$pass);
curl_setopt($ch, CURLOPT_POST
, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS
,"follow=true");
curl_setopt($ch, CURLOPT_RETURNTRANSFER
, 1);
$apiresponse = curl_exec($ch);
if ($apiresponse) {
$response = json_decode($apiresponse);
if ($response != null) {
if (property_exists
($response,"following")) {
if ($response->following === true) {
echo "Now following " . $response->screen_name . "\n";
} else {
echo "Couldn't follow " . $response->screen_name . "\n";
}
} else {
echo "Follow limit exceeded, skipped " . $from_user . "\n";
}
}
}
curl_close($ch);
} else {
echo "Already following " . $from_user . "\n";
}
}
}
}
}
?>
This code works great with cron jobs. If I could add a array of users not to follow, this script will be perfect for me.
Code source: http://code.google.com/p/twitter-autofollow/downloads/list