diff --git a/OpenTween/Api/GraphQL/TimelineTweet.cs b/OpenTween/Api/GraphQL/TimelineTweet.cs index 8507df49e..f8bb804d3 100644 --- a/OpenTween/Api/GraphQL/TimelineTweet.cs +++ b/OpenTween/Api/GraphQL/TimelineTweet.cs @@ -52,14 +52,7 @@ public TwitterStatus ToTwitterStatus() try { var resultElm = this.Element.Element("tweet_results")?.Element("result") ?? throw CreateParseError(); - var tweetElm = resultElm.Element("__typename")?.Value switch - { - "Tweet" => resultElm, - "TweetWithVisibilityResults" => resultElm.Element("tweet") ?? throw CreateParseError(), - _ => throw CreateParseError(), - }; - - return this.ParseTweet(tweetElm); + return this.ParseTweetUnion(resultElm); } catch (WebApiException ex) { @@ -69,6 +62,18 @@ public TwitterStatus ToTwitterStatus() } } + private TwitterStatus ParseTweetUnion(XElement tweetUnionElm) + { + var tweetElm = tweetUnionElm.Element("__typename")?.Value switch + { + "Tweet" => tweetUnionElm, + "TweetWithVisibilityResults" => tweetUnionElm.Element("tweet") ?? throw CreateParseError(), + _ => throw CreateParseError(), + }; + + return this.ParseTweet(tweetElm); + } + private TwitterStatus ParseTweet(XElement tweetElm) { var tweetLegacyElm = tweetElm.Element("legacy") ?? throw CreateParseError(); @@ -142,7 +147,7 @@ static string GetText(XElement elm, string name) ScreenName = GetText(userLegacyElm, "screen_name"), Protected = GetTextOrNull(userLegacyElm, "protected") == "true", }, - RetweetedStatus = retweetedTweetElm != null ? this.ParseTweet(retweetedTweetElm) : null, + RetweetedStatus = retweetedTweetElm != null ? this.ParseTweetUnion(retweetedTweetElm) : null, }; } diff --git a/OpenTween/Resources/ChangeLog.txt b/OpenTween/Resources/ChangeLog.txt index 06d091410..2d5ec7c62 100644 --- a/OpenTween/Resources/ChangeLog.txt +++ b/OpenTween/Resources/ChangeLog.txt @@ -1,6 +1,7 @@ 更新履歴 ==== Unreleased + * FIX: リプライ制限されたツイートのRTがリストのタイムラインに含まれているとエラーになる不具合を修正 ==== Ver 3.6.1(2023/07/07) * CHG: graphqlエンドポイントからのレスポンスの読み込み失敗時に問題の起きたツイートをErrorLogsに書き出す機能を追加