0

twitter4j ライブラリを使用して、パブリック twitter ストリームにアクセスしています。ジオタグ付きのツイートを含むプロジェクトを作成しようとしていますが、テストのために多数のツイートを収集する必要があります。

現在、フィルター処理されていないストリームを Twitter から取得し、ジオタグ付きのツイートのみを保存しています。ただし、大部分のツイートにはジオタグがないため、これは低速です。Twitter ストリームで、ジオタグ付きのツイートのみを送信してもらいたいです。

[この質問][1] で説明されている方法を使用してみました。ここでは、サイズ 360* x 180* のバウンディング ボックスでフィルタリングしますが、うまくいきません。そのフィルターを使用してもエラーは発生しませんが、ジオタグのないツイートの 99% を取得しています. これが私がやっている方法です:

    DefaultHttpClient httpclient = new DefaultHttpClient();
    httpclient.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
            new DefaultHttpMethodRetryHandler());
    HttpGet httpget = new HttpGet("https://developers.facebook.com/docs/reference/api/examples/");
    HttpResponse response = httpclient.execute(httpget);
    HttpEntity entity = response.getEntity();
    if (entity != null) {
        entity.consumeContent();
    }
    List<Cookie> cookies = httpclient.getCookieStore().getCookies();
    HttpPost httpost = new HttpPost(
    "https://www.facebook.com/login.php?login_attempt=1");
    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    nvps.add(new BasicNameValuePair("email", "xxxxxxxxxxxxxx"));
    nvps.add(new BasicNameValuePair("pass", "ssssssss"));
    httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
    response = httpclient.execute(httpost);
    entity = response.getEntity();
    if (entity != null) {
        entity.consumeContent();
    }
    CookieStore cookiestrore = httpclient.getCookieStore();
    //cookies = httpclient.getCookieStore().getCookies();
    //httpclient.getConnectionManager().shutdown();
    return cookiestrore;

これでエラーは発生しませんが、結果が得られません。

4

1 に答える 1