TweetStream
Query public data flowing through Twitter.
ビュー固有の情報
TweetStream は、処理が終了させられるまで継続して読み出される公開ツイートのストリームです。
Select
次のフィールドで結果セットをフィルタリングできます。
Follow | ユーザーID のカンマ区切りのリストで、ストリームに配信されるツイートをフォローしているユーザーを示します。 |
Track | フレーズを含むストリームでツイートを配信するために使われるカンマ区切りのフレーズのリスト。 |
Language | カンマ区切りのリストで指定された言語で書かれたツイートを返します。'en'、'fr'、'ja' のようなBCP 47 言語識別子を使用する必要があります。入力されたcoordinates が正しくない場合、Twitter は"406 Not Acceptable" エラーを返します。 |
Locations | ツイートをフィルタリングする緯度経度ペアのカンマ区切りのリスト。少なくとも2組の緯度経度の座標を使用する必要があり、最初のペアには、検索する地域の南西の境界を示します。 |
BackfillCount | ストリームエンドポイントに再接続する際に、BackfillCount パラメータが含まれると接続されていなかったときに見逃したメッセージを再現します。使用できる値は1 から 150000 もしくは -1から -150000 の整数です。正の数が指定された場合、バックフィル値がクライアントに渡された後にはストリームはライブ値へ戻されます。負の数が指定された場合、バックフィル値がクライアントに渡された後にはストリームは切断されます。このフィルタは、以下のアクセス権の 昇格したユーザーにのみ許可されます:Firehose、Links、Birddog、およびShadow。ロールがこのフィルタをサポートしていない場合、Twitter は"416 Requested Range Not Satisfiable" エラーを返します。 |
Filter_Level | 返されるツイートのレベル。デフォルト値はNONE で、すべてのツイートを含みます。 |
SELECT * FROM TweetStream WHERE Follow = '51192312'
Follow、Track、もしくはLanguage がいずれも指定されていない場合、すべての公開ツイートから小さい数のランダムなサンプルツイートが返されます。他のフィルタを使用しても、Twitter のストリーミング結果には影響しません。
ツイートの本文に'Assembly' という単語を含むツイートを多数取得します。
SELECT * FROM TweetStream WHERE Track = 'Assembly' AND Filter_Level='low'
次のフィルタは、ニューヨーク市から発信されたすべてのツイートを取得します。
SELECT * FROM TweetStream WHERE Locations = '-74,40,-73,41'
'fillet' という単語を含むフランス語または英語のツイートを取得します。切断されている場合は、50ツイート後に取得を中止します。
SELECT * FROM TweetStream WHERE Track = 'fillet' AND Language = 'fr,en' AND BackfillCount='-50'
Columns
Name | Type | Description |
Id [KEY] | String | Unique identifier of the Tweet. |
RuleId [KEY] | String | ID of the filter rule that matched against the Tweet delivered. |
AuthorId | String | Unique identifier of the author. |
ContextAnnotations | String | Contains context annotations for the Tweet. |
ConversationId | String | The Tweet ID of the original Tweet of the conversation (which includes direct replies, replies of replies). |
CreatedAt | Datetime | Creation time of the Tweet. |
Entities | String | Contains details about text that has a special meaning in a Tweet. |
InReplyToUserId | String | If this Tweet is a Reply, indicates the user ID of the parent Tweet's author. |
Lang | String | Language of the Tweet, if detected by Twitter. Returned as a BCP47 language tag. |
PossiblySensitive | Bool | Indicates if this Tweet contains URLs marked as sensitive, for example content suitable for mature audiences. |
ReferencedTweets | String | A list of Tweets this Tweet refers to. |
ReplySettings | String | Shows who can reply to this Tweet. Fields returned are everyone, mentionedUsers, and following. |
Source | String | The name of the app the user Tweeted from. |
Text | String | The content of the Tweet. |
EditHistoryTweetIds | String | Unique identifiers indicating all versions of an edited Tweet. For Tweets with no edits, there will be one ID. For Tweets with an edit history, there will be multiple IDs. |
GeoCoordinates | String | A pair of decimal values representing the precise location of the user (latitude, longitude). This value be null unless the user explicitly shared their precise location. |
GeoCoordinatesType | String | Describes the type of coordinate. |
GeoPlaceId | String | The unique identifier of the place, if this is a point of interest tagged in the Tweet. |
AttachmentsMediaKeys | String | List of unique identifiers of media attached to this Tweet. |
AttachmentsPollIds | String | List of unique identifiers of polls present in the Tweets returned. |
EditsRemaining | Int | Indicates the number of remaining edits for the tweet. |
IsEditEligible | Bool | Indicates if a Tweet is eligible for edit. |
EditableUntil | Datetime | Indicates how long the tweet is editable for. |
RetweetCount | Int | Number of times this Tweet has been Retweeted. |
ReplyCount | Int | Number of Replies of this Tweet. |
LikeCount | Int | Number of Likes of this Tweet. |
QuoteCount | Int | Number of times this Tweet has been Retweeted with a comment (also known as Quote). |
ImpressionCount | Int | Number of times this Tweet has been viewed. |
WithheldCopyRight | String | Indicates if the content is being withheld for on the basis of copyright infringement. |
WithheldCountryCodes | String | Provides a list of countries where this content is not available. |
WithheldScope | String | Indicates whether the content being withheld is a Tweet or a user. |
Pseudo-Columns
SELECT ステートメントのWHERE 句では、疑似列フィールドを使用して、データソースから返されるタプルを詳細に制御することができます。
Name | Type | Description |
BackfillMinutes | Int | By passing this parameter, you can recover up to five minutes worth of data that you might have missed during a disconnection. The backfilled Tweets will automatically flow through a reconnected stream, with older Tweets generally being delivered before any newly matching Tweets. You must include a whole number between 1 and 5 as the value to this parameter. To use this, please make sure your system is tolerant of duplicate data. |