Table of Contents

Class TwitterException

Namespace
Twikit
Assembly
Twikit.dll

twikit が送出する例外の基底クラス。

public class TwitterException : Exception, ISerializable
Inheritance
TwitterException
Implements
Derived
Inherited Members

Remarks

X は HTTP ステータスに加えて本文中に数値の code を返し、実際に何が 起きたかを伝えるのはそちらです。実際に観測したコードの一覧:

code意味
32認証情報が不正または期限切れ。Cookie が死んでいるときの典型。
34エンドポイントが存在しない。v1.1 のいくつかがこれを返すようになった。
37このリソースへの権限が無い。文言に "suspend" が無い限り凍結ではない。
63アカウントが凍結されている。
64認証中のアカウントが凍結されている。
88レート制限超過。RateLimitReset を参照。
89トークンが不正または期限切れ。
139すでにいいね済み。
144その ID のツイートは存在しない。
179このツイートを見る権限が無い(鍵アカウント)。
187重複ツイート。同じ本文を直近に投稿している。
226自動化されたリクエストと判定された。アカウント単位のスパムスコア。
279DM の会話が存在しない。
326アカウントが一時的にロックされている。AccountLockedException を参照。
349このユーザーにはメッセージを送れない(フォロー外からの DM を受け付けていない)。
398人間であることを確認できない(ログイン時の Arkose/FunCaptcha)。
399castle トークンが必要なログインチャレンジ。

同じ呼び出しで出たり出なかったりする 404 は、ほぼ例外なくエンドポイントではなく x-client-transaction-id のハンドシェイクが原因です。X はこのヘッダーを 選択的に検証するため、古いキーで作った ID は通る操作と弾かれる操作があります。 キーの元になる ondemand.s バンドルは数日ごとに入れ替わるので、長時間動かす プロセスは散発的な 404 に劣化していきます。RefreshTransaction() でハンドシェイクをやり直すと解消します。

Constructors

TwitterException()

public TwitterException()

TwitterException(string?)

public TwitterException(string? message)

Parameters

message string

TwitterException(string?, IReadOnlyDictionary<string, string>?, Exception?)

public TwitterException(string? message, IReadOnlyDictionary<string, string>? headers, Exception? innerException = null)

Parameters

message string
headers IReadOnlyDictionary<string, string>
innerException Exception

TwitterException(string?, Exception?)

public TwitterException(string? message, Exception? innerException)

Parameters

message string
innerException Exception

Properties

Headers

例外の元になったレスポンスのヘッダー(無い場合は null)。

public IReadOnlyDictionary<string, string>? Headers { get; }

Property Value

IReadOnlyDictionary<string, string>