mixi足あとツール(だめ、ぜったい)
昨日飲んでるとき
「mixiの自動巡回ツールを3000円で買った奴がいる」
という話を聞いて、なんてこった、と思ったので
↓自分もちょっと書いてみた。
使い方
インスタンス作ってpatrolProfilePage()にidを渡すと、そのid人のページに足跡がつきます。
forループでかたっぱしからつけるもよし。
ランダムに踏むもよし。。。
いやいや
多分規約に触れるのでやらないようにw
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; public class MixiPatrol { private static final String HOST = "http://mixi.jp"; private static final String LOGIN = "/login.pl"; private static HttpClient httpClient = new DefaultHttpClient(); public MixiPatrol(String email, String password) { login(email, password); } private void login(String email, String password) { HttpPost httpPost = new HttpPost(HOST + LOGIN); try { ArrayList<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("next_url", "/home.pl")); params.add(new BasicNameValuePair("email", email)); params.add(new BasicNameValuePair("password", password)); httpPost.setEntity(new UrlEncodedFormEntity(params, "EUC-JP")); HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); InputStream in = entity.getContent(); BufferedReader br = new BufferedReader(new InputStreamReader(in, "EUC-JP")); String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void patrolProfilePage(int id) { try { HttpGet httpGet = new HttpGet(HOST + "/show_friend.pl?id=" + String.valueOf(id)); HttpResponse response = httpClient.execute(httpGet); HttpEntity entity = response.getEntity(); InputStream in = entity.getContent(); BufferedReader br = new BufferedReader(new InputStreamReader(in, "EUC-JP")); String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }