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 | 自動化されたリクエストと判定された。アカウント単位のスパムスコア。 |
| 279 | DM の会話が存在しない。 |
| 326 | アカウントが一時的にロックされている。AccountLockedException を参照。 |
| 349 | このユーザーにはメッセージを送れない(フォロー外からの DM を受け付けていない)。 |
| 398 | 人間であることを確認できない(ログイン時の Arkose/FunCaptcha)。 |
| 399 | castle トークンが必要なログインチャレンジ。 |
同じ呼び出しで出たり出なかったりする 404 は、ほぼ例外なくエンドポイントではなく
x-client-transaction-id のハンドシェイクが原因です。X はこのヘッダーを
選択的に検証するため、古いキーで作った ID は通る操作と弾かれる操作があります。
キーの元になる ondemand.s バンドルは数日ごとに入れ替わるので、長時間動かす
プロセスは散発的な 404 に劣化していきます。RefreshTransaction()
でハンドシェイクをやり直すと解消します。
Constructors
TwitterException()
public TwitterException()
TwitterException(string?)
public TwitterException(string? message)
Parameters
messagestring
TwitterException(string?, IReadOnlyDictionary<string, string>?, Exception?)
public TwitterException(string? message, IReadOnlyDictionary<string, string>? headers, Exception? innerException = null)
Parameters
messagestringheadersIReadOnlyDictionary<string, string>innerExceptionException
TwitterException(string?, Exception?)
public TwitterException(string? message, Exception? innerException)
Parameters
Properties
Headers
例外の元になったレスポンスのヘッダー(無い場合は null)。
public IReadOnlyDictionary<string, string>? Headers { get; }