Twitter

Software as a service withdrawal and discontinuance: IBM Social Media Insight

https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS917-018&appname=USN

Powertrack users – Insights for Twitter is moving to Gnip 2.0

https://www.ibm.com/blogs/bluemix/2016/10/insights-for-twitter-moving-to-gnip-2/

Welcome to Gnip 2.0

http://support.gnip.com/gnip2.0/

https://console.ng.bluemix.net/docs/services/Twitter/index.html#insights_twitter_overview

https://cdeservice.mybluemix.net/rest-api/#!/messages

IBM Insights for Twitter Demo App

https://cdetestapp.mybluemix.net/

API Document

https://cdeservice.mybluemix.net/rest-api/#!/ibm_twitter_insights/getTweets

https://developer.ibm.com/answers/topics/insights-twitter/?smartspace=bluemix

http://support.gnip.com/apis/firehose/overview.html

Decahose (Twitter Only)

Decahose provides a 10% random sample of the realtime Twitter Firehose through a streaming connection. This is accomplished via a realtime sampling algorithm which randomly selects the data, while still allowing for the expected low-latency delivery of data as it is sent through the firehose by Twitter.

http://dotnsf.blog.jp/tag/decahose

> Free プランで取得できるデータ源は decahose と呼ばれているもので、ツイートデータ全体の約10分の1が母集団になっています(つまり、検索データベースの中に含まれていないツイートも多い)。標準の Twitter API を一般の開発者が使う場合もこの decahose を対象にツイートデータを取得できる、というものです。

https://egotter.com

Insights for Twitter

IBM Insights for Twitter を使用して、Twitter の検索結果を Bluemix アプリケーションに組み込みます。 このサービスは、IBM ソーシャル・メディア分析の高度な自然言語処理アルゴリズムに基づいた、感情その他の拡張情報を複数の言語で提供します。 Twitter データ・ストリームのリアルタイムでの処理が完全にサポートされています。これは、充実したクエリーのパラメーターとキーワードのセットを使用して構成す ることが可能です。 Insights for Twitter には、検索をカスタマイズして、ツイートおよび拡張情報を JSON 形式で返すことを可能にする、RESTful API が含まれます。

Twitter データ

Twitter Decahose の Twitter の内容を検索します。 Content Store が頻繁に更新されて索引付けされることにより、検索が動的かつ高速になります。 履歴ツイートの検索も、2013 年 11 月以降のコンテンツでサポートされています。 返されるツイートは、Twitter データの Gnip アクティビティー・ストリーム形式に従うものになります (http://support.gnip.com/sources/twitter/data_format.html)。

PowerTrack

Twitter の内容をフィルターしてリアルタイムにアクセスできます。ルールや追跡を作成、編集、集計、または削除して Content Store への接続をカスタマイズし、アプリケーションのパフォーマンスを最適化できます。PowerTrack ストリームは、エントリー・プランをご利用のお客様のみ使用できます。

拡張情報

作成者の性別および永住地 (国、州、および市区町村によって定義される) やツイートの感情 (英語、ドイツ語、フランス語、スペイン語のツイートにおける「肯定」、「否定」、「両面感情」、「中間」など) といった、Twitter Decahose ストリームのリアルタイム分析に基づいた詳細な拡張情報を取得できます。

無料プラン 500 万件のツイート 無料

Insights for Twitter 無料プランは、1 つの Bluemix アカウントに対して最大 500 万件のツイートを提供します。 ツイートは、要求された結果セットで返されるツイートの数に基づいてカウントされます。 アカウントの詳細ページには、Bluemix アカウントで取得されるツイートの合計数を追跡するためのカウンターが備わっています。 ツイートの最大制限数に達すると、無料プランでは、クラウド・サービスがエントリー・プランにアップグレードされない限り、Twitter コンテンツを取得できなくなります。 ツイートを返さない API は引き続き使用できます。

エントリー・プラン 100 万件のツイート ¥210,000.00 JPY/Month

Insights for Twitter エントリー・プランは、暦月ごとの各請求期間に、1 つの Bluemix アカウントに対して最大 100 万件のツイートを提供します。 請求期間内での比例分配は行われません。 ツイートは、要求された結果セットで返されるツイートの数に基づいてカウントされます。 アカウントの詳細ページには、Bluemix アカウントで取得されるツイートの合計数を追跡するためのカウンターが備わっています。 ツイートの最大制限数に達すると、クラウド・サービスでは、次の月になるまで Twitter コンテンツを取得できません。 ツイートを返さない API は引き続き使用できます。Decahose のすべてのツイートにアクセスできるだけでなく、最大 1,000 個のルールを作成して最大 100 万件の PowerTrack ツイートを取得できます。

Code Sample

package hello.twtr;

import java.io.File;

import java.io.IOException;

import java.net.URI;

import java.net.URLEncoder;

import org.apache.commons.io.FileUtils;

import org.apache.http.Consts;

import org.apache.http.HttpResponse;

import org.apache.http.client.ResponseHandler;

import org.apache.http.client.fluent.Executor;

import org.apache.http.client.fluent.Request;

import org.apache.http.util.EntityUtils;

public class HelloTWTRMainFormatted {

public static void main(String[] args) throws Exception {

// see

// https://cdeservice.mybluemix.net/rest-api/#!/ibm_twitter_insights/getTweets

// リクエストパラメータ

String q = "日本 IBM";

// Starting record.

// おそらくツイートのIDを指定する

String from = null;

// Specifies the number of records to return. The maximum value is 500.

// The value defaults to 100 if this parameter is empty.

String size = "500";

q = URLEncoder.encode(q, "UTF-8");

// リクエストパラメータ

String username = "your username";

String password = "your password";

String baseURL = "https://" + username + ":" + password

+ "@cdeservice.mybluemix.net:443/api/v1/messages/search";

try {

Executor executor = Executor.newInstance().auth(username, password);

URI serviceURI = new URI(baseURL + "?q=" + q + "&size=" + size)

.normalize();

System.err.println("serviceURI: " + serviceURI.toString());

System.err.println("username: " + username);

ResponseHandler<String> myHandler = new ResponseHandler<String>() {

@Override

public String handleResponse(final HttpResponse response)

throws IOException {

return EntityUtils.toString(response.getEntity(),

Consts.UTF_8);

}

};

String answersJson = executor.execute(

Request.Get(serviceURI)

.addHeader("Accept", "application/json")

.addHeader("X-SyncTimeout", "30")).handleResponse(

myHandler);

FileUtils.writeStringToFile(new File("c:/temp2.json"), answersJson,

"UTF-8");

System.err.println("OK");

} catch (Exception e) {

e.printStackTrace();

}

}

}