Table of Contents

Class Tweet

Namespace
Twikit
Assembly
Twikit.dll

ツイート。

public class Tweet : IEquatable<Tweet>
Inheritance
Tweet
Implements
Inherited Members

Constructors

Tweet(Client, JsonObject, User?)

public Tweet(Client client, JsonObject data, User? user = null)

Parameters

client Client
data JsonObject
user User

Properties

Article

添付された長文記事(Article)。無ければ null。 記事を持つツイートの Text には t.co のリンクしか無いため、タイトルと導入文はここから読みます。 X は本文を送ってこないので、得られるのはタイトル・プレビュー・カバー画像だけです。

public Article? Article { get; }

Property Value

Article

BookmarkCount

ブックマークの数。

public int BookmarkCount { get; }

Property Value

int

Bookmarked

ブックマーク済みか。

public bool Bookmarked { get; }

Property Value

bool

Community

コミュニティタイムラインから取得した場合の所属コミュニティ。

public Community? Community { get; set; }

Property Value

Community

CommunityNote

コミュニティノートの要約(無ければ null)。

public BirdwatchNote? CommunityNote { get; }

Property Value

BirdwatchNote

ConversationIds

このツイートが含まれていた会話モジュール内の全ツイート ID(X がまとめたもの)。 会話モジュール経由でなければ null。

public List<string>? ConversationIds { get; set; }

Property Value

List<string>

CreatedAt

作成日時(X の表記)。

public string? CreatedAt { get; }

Property Value

string

CreatedAtDatetime

CreatedAt を DateTimeOffset にしたもの。

public DateTimeOffset CreatedAtDatetime { get; }

Property Value

DateTimeOffset

Data

X から受け取った生の JSON(tweet result)。

public JsonObject Data { get; }

Property Value

JsonObject

EditTweetIds

編集履歴のツイート ID。

public List<string> EditTweetIds { get; }

Property Value

List<string>

EditableUntilMsecs

編集可能な期限(ミリ秒)。

public long? EditableUntilMsecs { get; }

Property Value

long?

EditsRemaining

残りの編集回数。

public int? EditsRemaining { get; }

Property Value

int?

FavoriteCount

いいねの数。

public int FavoriteCount { get; }

Property Value

int

Favorited

いいね済みか。

public bool Favorited { get; }

Property Value

bool

FullText

全文。長文ツイートは note_tweet から、リツイートは元ツイートの本文を返します (リツイート自身の本文は 140 文字で切り詰められているため)。RT @user: ... 形式が欲しければ Text。

public string FullText { get; }

Property Value

string

HasCard

カードを持つか。

public bool HasCard { get; }

Property Value

bool

HasCommunityNotes

コミュニティノートが付いているか。

public bool HasCommunityNotes { get; }

Property Value

bool

Hashtags

本文に含まれるハッシュタグ。

public List<string> Hashtags { get; }

Property Value

List<string>

Highlighted

投稿者のプロフィールの「ハイライト」タブに入っているか(Premium 機能)。 X はタイムラインやツイート取得にこのフラグを含めないため、GetUserHighlightsTweetsAsync(string, int, string?) で取得した ツイートか、IsHighlightedAsync()・HighlightAsync()・UnhighlightAsync() を呼んだあと以外は null です(「不明」であり「いいえ」ではありません)。

public bool? Highlighted { get; }

Property Value

bool?

Id

ツイートの一意な ID。

public string Id { get; }

Property Value

string

InReplyTo

返信先のツイート ID。

public string? InReplyTo { get; }

Property Value

string

IsEditEligible

編集可能か。

public bool IsEditEligible { get; }

Property Value

bool

IsQuoteStatus

引用ツイートか。

public bool IsQuoteStatus { get; }

Property Value

bool

IsTranslatable

翻訳可能か。

public bool IsTranslatable { get; }

Property Value

bool

Lang

言語。

public string? Lang { get; }

Property Value

string

Legacy

legacy ブロック。

public JsonObject Legacy { get; }

Property Value

JsonObject

Media

添付メディア(Photo、Video、AnimatedGif)。

public List<Media> Media { get; }

Property Value

List<Media>

Place

関連付けられた場所(無ければ null)。

public Place? Place { get; }

Property Value

Place

Poll

投票(無ければ null)。

public Poll? Poll { get; }

Property Value

Poll

PossiblySensitive

センシティブな内容を含む可能性があるか。

public bool PossiblySensitive { get; }

Property Value

bool

PossiblySensitiveEditable

public bool PossiblySensitiveEditable { get; }

Property Value

bool

Quote

引用元のツイート。

public Tweet? Quote { get; }

Property Value

Tweet

QuoteCount

引用された数。

public int QuoteCount { get; }

Property Value

int

QuotedStatusId

引用元ツイートの ID(引用ツイートの場合)。

public string? QuotedStatusId { get; }

Property Value

string

RelatedTweets

関連ツイート。

public List<Tweet>? RelatedTweets { get; set; }

Property Value

List<Tweet>

Replies

ツイートへの返信。

public Result<Tweet>? Replies { get; set; }

Property Value

Result<Tweet>

ReplyCount

返信の数。

public int ReplyCount { get; }

Property Value

int

ReplyTo

このツイートが返信している先のツイート(会話の上流)。

public List<Tweet>? ReplyTo { get; set; }

Property Value

List<Tweet>

RetweetCount

リツイートの数。

public int RetweetCount { get; }

Property Value

int

RetweetedTweet

リツイート元のツイート。

public Tweet? RetweetedTweet { get; }

Property Value

Tweet

Source

投稿元クライアントを表す生のアンカー(例: <a href="...">Twitter for iPhone</a>)。

public string? Source { get; }

Property Value

string

SourceName

Source から取り出したクライアント名。

public string? SourceName { get; }

Property Value

string

SourceUrl

Source から取り出したクライアントの URL。

public string? SourceUrl { get; }

Property Value

string

Text

本文。リツイートの場合は RT @user: ... の形式(140 文字で切り詰められる)。

public string Text { get; }

Property Value

string

Thread

投稿者自身によるスレッド(古い順、このツイート自身を含む)。

public List<Tweet>? Thread { get; set; }

Property Value

List<Tweet>

ThumbnailTitle

カードに表示される Web ページのタイトル。

public string? ThumbnailTitle { get; }

Property Value

string

ThumbnailUrl

カードに表示される画像の URL。

public string? ThumbnailUrl { get; }

Property Value

string

Url

x.com 上の正規 URL。

public string Url { get; }

Property Value

string

Urls

本文に含まれる URL(常にリスト)。

public List<UrlEntity> Urls { get; }

Property Value

List<UrlEntity>

User

ツイートの投稿者。

public User? User { get; set; }

Property Value

User

ViewCount

表示回数。無ければ null。

public long? ViewCount { get; }

Property Value

long?

Remarks

X が数値を送るかどうかは呼び出し方ではなくツイート側の性質です。 ViewCountState が 'EnabledWithCount' なら数値があり、'Enabled' なら X が伏せています。

ViewCountState

表示回数の状態。

public string? ViewCountState { get; }

Property Value

string

Methods

BookmarkAsync()

ブックマークに追加します。

public Task<HttpResponseMessage> BookmarkAsync()

Returns

Task<HttpResponseMessage>

DeleteAsync()

ツイートを削除します。

public Task<HttpResponseMessage> DeleteAsync()

Returns

Task<HttpResponseMessage>

DeleteBookmarkAsync()

ブックマークから削除します。

public Task<HttpResponseMessage> DeleteBookmarkAsync()

Returns

Task<HttpResponseMessage>

DeleteRetweetAsync()

リツイートを取り消します。

public Task<HttpResponseMessage> DeleteRetweetAsync()

Returns

Task<HttpResponseMessage>

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(Tweet?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Tweet? other)

Parameters

other Tweet

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

FavoriteAsync()

いいねします。

public Task<HttpResponseMessage> FavoriteAsync()

Returns

Task<HttpResponseMessage>

FromData(Client, JsonNode?)

タイムラインのエントリなどから Tweet を作ります(Python 版の tweet_from_data)。 墓石(削除済み)や投稿者情報の無いエントリは null。

public static Tweet? FromData(Client client, JsonNode? data)

Parameters

client Client
data JsonNode

Returns

Tweet

GetCommunityNotesAsync()

この投稿に提案されたコミュニティノートをすべて取得します。

public Task<List<CommunityNote>> GetCommunityNotesAsync()

Returns

Task<List<CommunityNote>>
See Also

GetFavoritersAsync(int, string?)

いいねしたユーザーを取得します。

public Task<Result<User>> GetFavoritersAsync(int count = 40, string? cursor = null)

Parameters

count int
cursor string

Returns

Task<Result<User>>

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetRetweetersAsync(int, string?)

リツイートしたユーザーを取得します。

public Task<Result<User>> GetRetweetersAsync(int count = 40, string? cursor = null)

Parameters

count int
cursor string

Returns

Task<Result<User>>

GetSimilarTweetsAsync()

類似ツイートを取得します(Premium のみ)。

public Task<List<Tweet>> GetSimilarTweetsAsync()

Returns

Task<List<Tweet>>

HighlightAsync()

プロフィールの「ハイライト」タブに追加します(Premium のみ)。成功すると Highlighted も true になります。

public Task<HttpResponseMessage> HighlightAsync()

Returns

Task<HttpResponseMessage>

IsHighlightedAsync()

X に問い合わせてハイライト済みかを返し、結果を Highlighted に保存します。

public Task<bool> IsHighlightedAsync()

Returns

Task<bool>

PinAsync()

自分のプロフィールにピン留めします。

public Task<HttpResponseMessage> PinAsync()

Returns

Task<HttpResponseMessage>
See Also

ReplyAsync(string, IList<string>?, string?, string?, string?, bool, bool, JsonArray?, string?)

このツイートに返信します。

public Task<Tweet> ReplyAsync(string text = "", IList<string>? mediaIds = null, string? conversationControl = null, string? attachmentUrl = null, string? communityId = null, bool shareWithFollowers = false, bool isNoteTweet = false, JsonArray? richtextOptions = null, string? editTweetId = null)

Parameters

text string

返信の本文。

mediaIds IList<string>

添付するメディア ID の一覧。

conversationControl string

返信できる相手('followers'、'verified'、'mentioned')。

attachmentUrl string

引用するツイートの URL。

communityId string

投稿先コミュニティの ID。

shareWithFollowers bool

コミュニティ投稿をフォロワーにも共有するか。

isNoteTweet bool

280 文字を超える長文ツイートにするか(Premium)。

richtextOptions JsonArray

装飾オプション(Premium)。

editTweetId string

編集するツイートの ID(Premium)。

Returns

Task<Tweet>

RetweetAsync()

リツイートします。

public Task<HttpResponseMessage> RetweetAsync()

Returns

Task<HttpResponseMessage>

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

TranslateAsync(string?)

Grok でこのツイートを翻訳します。

public Task<TweetTranslation> TranslateAsync(string? dstLang = null)

Parameters

dstLang string

翻訳先の言語コード。省略時はクライアントの言語。

Returns

Task<TweetTranslation>
See Also

UnfavoriteAsync()

いいねを解除します。

public Task<HttpResponseMessage> UnfavoriteAsync()

Returns

Task<HttpResponseMessage>

UnhighlightAsync()

プロフィールの「ハイライト」タブから外します。成功すると Highlighted も false になります。

public Task<HttpResponseMessage> UnhighlightAsync()

Returns

Task<HttpResponseMessage>

UnpinAsync()

自分のプロフィールのピン留めを外します。

public Task<HttpResponseMessage> UnpinAsync()

Returns

Task<HttpResponseMessage>
See Also

UpdateAsync()

最新の情報で更新します。

public Task UpdateAsync()

Returns

Task