From ec557fc5ee40629f5db6651c7b80c82c2f0a07bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Wed, 30 Oct 2024 14:32:42 +0900 Subject: [PATCH] add Community option and enhance JSON parsing in generater.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 159 +++++++++------- .../compatible_discriminator/openapi-3.0.yaml | 159 +++++++++------- dist/docs/openapi-3.0.yaml | 172 +++++++++++++----- src/config/placeholder.json | 83 ++++++--- src/openapi/schemas/content.yaml | 1 + tools/generater.py | 31 +++- 6 files changed, 400 insertions(+), 205 deletions(-) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 306278b..5f0f1e7 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -1703,6 +1703,7 @@ components: - Sparkle - Conversation - List + - Community type: string landingUrl: $ref: '#/components/schemas/SocialContextLandingUrl' @@ -3211,7 +3212,7 @@ components: type: apiKey UserAgent: description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like - Gecko) Chrome/129.0.0.0 Safari/537.36 + Gecko) Chrome/130.0.0.0 Safari/537.36 in: header name: user-agent type: apiKey @@ -4002,8 +4003,8 @@ paths: name: pathQueryId required: true schema: - default: QUjXply7fA7fk05FRyajEg - example: QUjXply7fA7fk05FRyajEg + default: L7vvM2UluPgWOW4GDvWyvw + example: L7vvM2UluPgWOW4GDvWyvw type: string - in: query name: variables @@ -4788,8 +4789,8 @@ paths: name: pathQueryId required: true schema: - default: LLkw5EcVutJL6y-2gkz22A - example: LLkw5EcVutJL6y-2gkz22A + default: riUYr3PwuHNe4tCmzjPNrg + example: riUYr3PwuHNe4tCmzjPNrg type: string - in: query name: variables @@ -4804,30 +4805,34 @@ paths: name: features required: true schema: - default: '{"responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled": - false, "creator_subscriptions_tweet_preview_api_enabled": true, "responsive_web_graphql_timeline_navigation_enabled": - true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": - false, "c9s_tweet_anatomy_moderator_badge_enabled": true, "tweetypie_unmention_optimization_enabled": - true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": - true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": + default: '{"rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "creator_subscriptions_tweet_preview_api_enabled": + true, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "communities_web_enable_tweet_community_results_fetch": true, "c9s_tweet_anatomy_moderator_badge_enabled": + true, "articles_preview_enabled": true, "responsive_web_edit_tweet_api_enabled": + true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true, + "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": true, "responsive_web_twitter_article_tweet_consumption_enabled": true, - "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": - true, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + "tweet_awards_web_tipping_enabled": false, "creator_subscriptions_quote_tweet_preview_enabled": + false, "freedom_of_speech_not_reach_fetch_enabled": true, "standardized_nudges_misinfo": + true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true, "rweb_video_timestamps_enabled": true, "longform_notetweets_rich_text_read_enabled": - true, "longform_notetweets_inline_media_enabled": true, "responsive_web_media_download_video_enabled": - false, "responsive_web_enhance_cards_enabled": false}' - example: '{"responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled": - false, "creator_subscriptions_tweet_preview_api_enabled": true, "responsive_web_graphql_timeline_navigation_enabled": - true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": - false, "c9s_tweet_anatomy_moderator_badge_enabled": true, "tweetypie_unmention_optimization_enabled": - true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": - true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": + true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + example: '{"rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "creator_subscriptions_tweet_preview_api_enabled": + true, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "communities_web_enable_tweet_community_results_fetch": true, "c9s_tweet_anatomy_moderator_badge_enabled": + true, "articles_preview_enabled": true, "responsive_web_edit_tweet_api_enabled": + true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true, + "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": true, "responsive_web_twitter_article_tweet_consumption_enabled": true, - "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": - true, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + "tweet_awards_web_tipping_enabled": false, "creator_subscriptions_quote_tweet_preview_enabled": + false, "freedom_of_speech_not_reach_fetch_enabled": true, "standardized_nudges_misinfo": + true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true, "rweb_video_timestamps_enabled": true, "longform_notetweets_rich_text_read_enabled": - true, "longform_notetweets_inline_media_enabled": true, "responsive_web_media_download_video_enabled": - false, "responsive_web_enhance_cards_enabled": false}' + true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": + false}' type: string responses: '200': @@ -5144,8 +5149,8 @@ paths: name: pathQueryId required: true schema: - default: DiTkXJgLqBBxCs7zaYsbtA - example: DiTkXJgLqBBxCs7zaYsbtA + default: HyuV8ml52TYmyUjyrDq1CQ + example: HyuV8ml52TYmyUjyrDq1CQ type: string - in: query name: variables @@ -5234,19 +5239,19 @@ paths: name: pathQueryId required: true schema: - default: HJFjzBgCs16TqxewQOeLNg - example: HJFjzBgCs16TqxewQOeLNg + default: E6AtJXVPtK7nIHAntKc5fA + example: E6AtJXVPtK7nIHAntKc5fA type: string - in: query name: variables required: true schema: default: '{"count": 20, "includePromotedContent": true, "latestControlAvailable": - true, "requestContext": "launch", "withCommunity": true, "seenTweetIds": - ["1349129669258448897"]}' + true, "requestContext": "launch", "seenTweetIds": ["1349129669258448897"], + "withCommunity": true}' example: '{"count": 20, "includePromotedContent": true, "latestControlAvailable": - true, "requestContext": "launch", "withCommunity": true, "seenTweetIds": - ["1349129669258448897"]}' + true, "requestContext": "launch", "seenTweetIds": ["1349129669258448897"], + "withCommunity": true}' type: string - in: query name: features @@ -5326,8 +5331,8 @@ paths: name: pathQueryId required: true schema: - default: aeJWz--kknVBOl7wQ7gh7Q - example: aeJWz--kknVBOl7wQ7gh7Q + default: px6_YxfWkXo0odY84iqqmw + example: px6_YxfWkXo0odY84iqqmw type: string - in: query name: variables @@ -5373,6 +5378,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -5418,8 +5430,8 @@ paths: name: pathQueryId required: true schema: - default: Pa45JvqZuKcW1plybfgBlQ - example: Pa45JvqZuKcW1plybfgBlQ + default: f-Lsj0rHCztXcgdo585UUw + example: f-Lsj0rHCztXcgdo585UUw type: string - in: query name: variables @@ -5566,8 +5578,8 @@ paths: name: pathQueryId required: true schema: - default: 8019obfgnveiPiJuS2Rtow - example: 8019obfgnveiPiJuS2Rtow + default: rPcOnVhyaTBQrVgPuY7x7A + example: rPcOnVhyaTBQrVgPuY7x7A type: string - in: query name: variables @@ -5656,8 +5668,8 @@ paths: name: pathQueryId required: true schema: - default: UN1i3zUiCWa-6r-Uaho4fw - example: UN1i3zUiCWa-6r-Uaho4fw + default: MJpyQGqgklrVl_0X9gNy3A + example: MJpyQGqgklrVl_0X9gNy3A type: string - in: query name: variables @@ -5746,21 +5758,21 @@ paths: name: pathQueryId required: true schema: - default: QuBlQ6SxNAQCt6-kBiCXCQ - example: QuBlQ6SxNAQCt6-kBiCXCQ + default: nBS-WpgA6ZG0CyNHD517JQ + example: nBS-WpgA6ZG0CyNHD517JQ type: string - in: query name: variables required: true schema: default: '{"focalTweetId": "1349129669258448897", "referrer": "home", "with_rux_injections": - false, "includePromotedContent": true, "withCommunity": true, "withQuickPromoteEligibilityTweetFields": - true, "withBirdwatchNotes": true, "withVoice": true, "withV2Timeline": - true}' + false, "rankingMode": "Relevance", "includePromotedContent": true, "withCommunity": + true, "withQuickPromoteEligibilityTweetFields": true, "withBirdwatchNotes": + true, "withVoice": true}' example: '{"focalTweetId": "1349129669258448897", "referrer": "home", "with_rux_injections": - false, "includePromotedContent": true, "withCommunity": true, "withQuickPromoteEligibilityTweetFields": - true, "withBirdwatchNotes": true, "withVoice": true, "withV2Timeline": - true}' + false, "rankingMode": "Relevance", "includePromotedContent": true, "withCommunity": + true, "withQuickPromoteEligibilityTweetFields": true, "withBirdwatchNotes": + true, "withVoice": true}' type: string - in: query name: features @@ -5800,9 +5812,9 @@ paths: required: true schema: default: '{"withArticleRichContentState": true, "withArticlePlainText": - false}' + false, "withGrokAnalyze": false, "withDisallowedReplyControls": false}' example: '{"withArticleRichContentState": true, "withArticlePlainText": - false}' + false, "withGrokAnalyze": false, "withDisallowedReplyControls": false}' type: string responses: '200': @@ -6096,15 +6108,15 @@ paths: name: pathQueryId required: true schema: - default: Yka-W8dz7RaEuQNkroPkYw - example: Yka-W8dz7RaEuQNkroPkYw + default: BQ6xjFU6Mgm-WhEP3OiT9w + example: BQ6xjFU6Mgm-WhEP3OiT9w type: string - in: query name: variables required: true schema: - default: '{"screen_name": "elonmusk", "withSafetyModeUserFields": true}' - example: '{"screen_name": "elonmusk", "withSafetyModeUserFields": true}' + default: '{"screen_name": "elonmusk"}' + example: '{"screen_name": "elonmusk"}' type: string - in: query name: features @@ -6269,8 +6281,8 @@ paths: name: pathQueryId required: true schema: - default: dexO_2tohK86JDudXXG3Yw - example: dexO_2tohK86JDudXXG3Yw + default: HaouMjBviBKKTYZGV_9qtg + example: HaouMjBviBKKTYZGV_9qtg type: string - in: query name: variables @@ -6316,6 +6328,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -6361,8 +6380,8 @@ paths: name: pathQueryId required: true schema: - default: E3opETHurmVJflFsUBVuUQ - example: E3opETHurmVJflFsUBVuUQ + default: Tg82Ez_kxVaJf7OPbUdbCg + example: Tg82Ez_kxVaJf7OPbUdbCg type: string - in: query name: variables @@ -6408,6 +6427,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -6453,8 +6479,8 @@ paths: name: pathQueryId required: true schema: - default: bt4TKuFz4T7Ckk-VvQVSow - example: bt4TKuFz4T7Ckk-VvQVSow + default: HmWGzuzXoI6uFqqX6QNhEg + example: HmWGzuzXoI6uFqqX6QNhEg type: string - in: query name: variables @@ -6498,6 +6524,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -6543,8 +6576,8 @@ paths: name: pathQueryId required: true schema: - default: GYBpHkmyXjeuX9IeNJmweA - example: GYBpHkmyXjeuX9IeNJmweA + default: lc85bOG5T3IIS4u485VtBg + example: lc85bOG5T3IIS4u485VtBg type: string - in: query name: variables diff --git a/dist/compatible_discriminator/openapi-3.0.yaml b/dist/compatible_discriminator/openapi-3.0.yaml index 2b99bb2..811509e 100644 --- a/dist/compatible_discriminator/openapi-3.0.yaml +++ b/dist/compatible_discriminator/openapi-3.0.yaml @@ -1703,6 +1703,7 @@ components: - Sparkle - Conversation - List + - Community type: string landingUrl: $ref: '#/components/schemas/SocialContextLandingUrl' @@ -3211,7 +3212,7 @@ components: type: apiKey UserAgent: description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like - Gecko) Chrome/129.0.0.0 Safari/537.36 + Gecko) Chrome/130.0.0.0 Safari/537.36 in: header name: user-agent type: apiKey @@ -4002,8 +4003,8 @@ paths: name: pathQueryId required: true schema: - default: QUjXply7fA7fk05FRyajEg - example: QUjXply7fA7fk05FRyajEg + default: L7vvM2UluPgWOW4GDvWyvw + example: L7vvM2UluPgWOW4GDvWyvw type: string - in: query name: variables @@ -4772,8 +4773,8 @@ paths: name: pathQueryId required: true schema: - default: LLkw5EcVutJL6y-2gkz22A - example: LLkw5EcVutJL6y-2gkz22A + default: riUYr3PwuHNe4tCmzjPNrg + example: riUYr3PwuHNe4tCmzjPNrg type: string - in: query name: variables @@ -4788,30 +4789,34 @@ paths: name: features required: true schema: - default: '{"responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled": - false, "creator_subscriptions_tweet_preview_api_enabled": true, "responsive_web_graphql_timeline_navigation_enabled": - true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": - false, "c9s_tweet_anatomy_moderator_badge_enabled": true, "tweetypie_unmention_optimization_enabled": - true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": - true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": + default: '{"rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "creator_subscriptions_tweet_preview_api_enabled": + true, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "communities_web_enable_tweet_community_results_fetch": true, "c9s_tweet_anatomy_moderator_badge_enabled": + true, "articles_preview_enabled": true, "responsive_web_edit_tweet_api_enabled": + true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true, + "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": true, "responsive_web_twitter_article_tweet_consumption_enabled": true, - "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": - true, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + "tweet_awards_web_tipping_enabled": false, "creator_subscriptions_quote_tweet_preview_enabled": + false, "freedom_of_speech_not_reach_fetch_enabled": true, "standardized_nudges_misinfo": + true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true, "rweb_video_timestamps_enabled": true, "longform_notetweets_rich_text_read_enabled": - true, "longform_notetweets_inline_media_enabled": true, "responsive_web_media_download_video_enabled": - false, "responsive_web_enhance_cards_enabled": false}' - example: '{"responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled": - false, "creator_subscriptions_tweet_preview_api_enabled": true, "responsive_web_graphql_timeline_navigation_enabled": - true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": - false, "c9s_tweet_anatomy_moderator_badge_enabled": true, "tweetypie_unmention_optimization_enabled": - true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": - true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": + true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + example: '{"rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "creator_subscriptions_tweet_preview_api_enabled": + true, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "communities_web_enable_tweet_community_results_fetch": true, "c9s_tweet_anatomy_moderator_badge_enabled": + true, "articles_preview_enabled": true, "responsive_web_edit_tweet_api_enabled": + true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true, + "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": true, "responsive_web_twitter_article_tweet_consumption_enabled": true, - "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": - true, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + "tweet_awards_web_tipping_enabled": false, "creator_subscriptions_quote_tweet_preview_enabled": + false, "freedom_of_speech_not_reach_fetch_enabled": true, "standardized_nudges_misinfo": + true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true, "rweb_video_timestamps_enabled": true, "longform_notetweets_rich_text_read_enabled": - true, "longform_notetweets_inline_media_enabled": true, "responsive_web_media_download_video_enabled": - false, "responsive_web_enhance_cards_enabled": false}' + true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": + false}' type: string responses: '200': @@ -5120,8 +5125,8 @@ paths: name: pathQueryId required: true schema: - default: DiTkXJgLqBBxCs7zaYsbtA - example: DiTkXJgLqBBxCs7zaYsbtA + default: HyuV8ml52TYmyUjyrDq1CQ + example: HyuV8ml52TYmyUjyrDq1CQ type: string - in: query name: variables @@ -5208,19 +5213,19 @@ paths: name: pathQueryId required: true schema: - default: HJFjzBgCs16TqxewQOeLNg - example: HJFjzBgCs16TqxewQOeLNg + default: E6AtJXVPtK7nIHAntKc5fA + example: E6AtJXVPtK7nIHAntKc5fA type: string - in: query name: variables required: true schema: default: '{"count": 20, "includePromotedContent": true, "latestControlAvailable": - true, "requestContext": "launch", "withCommunity": true, "seenTweetIds": - ["1349129669258448897"]}' + true, "requestContext": "launch", "seenTweetIds": ["1349129669258448897"], + "withCommunity": true}' example: '{"count": 20, "includePromotedContent": true, "latestControlAvailable": - true, "requestContext": "launch", "withCommunity": true, "seenTweetIds": - ["1349129669258448897"]}' + true, "requestContext": "launch", "seenTweetIds": ["1349129669258448897"], + "withCommunity": true}' type: string - in: query name: features @@ -5298,8 +5303,8 @@ paths: name: pathQueryId required: true schema: - default: aeJWz--kknVBOl7wQ7gh7Q - example: aeJWz--kknVBOl7wQ7gh7Q + default: px6_YxfWkXo0odY84iqqmw + example: px6_YxfWkXo0odY84iqqmw type: string - in: query name: variables @@ -5345,6 +5350,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -5388,8 +5400,8 @@ paths: name: pathQueryId required: true schema: - default: Pa45JvqZuKcW1plybfgBlQ - example: Pa45JvqZuKcW1plybfgBlQ + default: f-Lsj0rHCztXcgdo585UUw + example: f-Lsj0rHCztXcgdo585UUw type: string - in: query name: variables @@ -5532,8 +5544,8 @@ paths: name: pathQueryId required: true schema: - default: 8019obfgnveiPiJuS2Rtow - example: 8019obfgnveiPiJuS2Rtow + default: rPcOnVhyaTBQrVgPuY7x7A + example: rPcOnVhyaTBQrVgPuY7x7A type: string - in: query name: variables @@ -5620,8 +5632,8 @@ paths: name: pathQueryId required: true schema: - default: UN1i3zUiCWa-6r-Uaho4fw - example: UN1i3zUiCWa-6r-Uaho4fw + default: MJpyQGqgklrVl_0X9gNy3A + example: MJpyQGqgklrVl_0X9gNy3A type: string - in: query name: variables @@ -5708,21 +5720,21 @@ paths: name: pathQueryId required: true schema: - default: QuBlQ6SxNAQCt6-kBiCXCQ - example: QuBlQ6SxNAQCt6-kBiCXCQ + default: nBS-WpgA6ZG0CyNHD517JQ + example: nBS-WpgA6ZG0CyNHD517JQ type: string - in: query name: variables required: true schema: default: '{"focalTweetId": "1349129669258448897", "referrer": "home", "with_rux_injections": - false, "includePromotedContent": true, "withCommunity": true, "withQuickPromoteEligibilityTweetFields": - true, "withBirdwatchNotes": true, "withVoice": true, "withV2Timeline": - true}' + false, "rankingMode": "Relevance", "includePromotedContent": true, "withCommunity": + true, "withQuickPromoteEligibilityTweetFields": true, "withBirdwatchNotes": + true, "withVoice": true}' example: '{"focalTweetId": "1349129669258448897", "referrer": "home", "with_rux_injections": - false, "includePromotedContent": true, "withCommunity": true, "withQuickPromoteEligibilityTweetFields": - true, "withBirdwatchNotes": true, "withVoice": true, "withV2Timeline": - true}' + false, "rankingMode": "Relevance", "includePromotedContent": true, "withCommunity": + true, "withQuickPromoteEligibilityTweetFields": true, "withBirdwatchNotes": + true, "withVoice": true}' type: string - in: query name: features @@ -5762,9 +5774,9 @@ paths: required: true schema: default: '{"withArticleRichContentState": true, "withArticlePlainText": - false}' + false, "withGrokAnalyze": false, "withDisallowedReplyControls": false}' example: '{"withArticleRichContentState": true, "withArticlePlainText": - false}' + false, "withGrokAnalyze": false, "withDisallowedReplyControls": false}' type: string responses: '200': @@ -6050,15 +6062,15 @@ paths: name: pathQueryId required: true schema: - default: Yka-W8dz7RaEuQNkroPkYw - example: Yka-W8dz7RaEuQNkroPkYw + default: BQ6xjFU6Mgm-WhEP3OiT9w + example: BQ6xjFU6Mgm-WhEP3OiT9w type: string - in: query name: variables required: true schema: - default: '{"screen_name": "elonmusk", "withSafetyModeUserFields": true}' - example: '{"screen_name": "elonmusk", "withSafetyModeUserFields": true}' + default: '{"screen_name": "elonmusk"}' + example: '{"screen_name": "elonmusk"}' type: string - in: query name: features @@ -6219,8 +6231,8 @@ paths: name: pathQueryId required: true schema: - default: dexO_2tohK86JDudXXG3Yw - example: dexO_2tohK86JDudXXG3Yw + default: HaouMjBviBKKTYZGV_9qtg + example: HaouMjBviBKKTYZGV_9qtg type: string - in: query name: variables @@ -6266,6 +6278,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -6309,8 +6328,8 @@ paths: name: pathQueryId required: true schema: - default: E3opETHurmVJflFsUBVuUQ - example: E3opETHurmVJflFsUBVuUQ + default: Tg82Ez_kxVaJf7OPbUdbCg + example: Tg82Ez_kxVaJf7OPbUdbCg type: string - in: query name: variables @@ -6356,6 +6375,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -6399,8 +6425,8 @@ paths: name: pathQueryId required: true schema: - default: bt4TKuFz4T7Ckk-VvQVSow - example: bt4TKuFz4T7Ckk-VvQVSow + default: HmWGzuzXoI6uFqqX6QNhEg + example: HmWGzuzXoI6uFqqX6QNhEg type: string - in: query name: variables @@ -6444,6 +6470,13 @@ paths: true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false}' type: string + - in: query + name: fieldToggles + required: true + schema: + default: '{"withArticlePlainText": false}' + example: '{"withArticlePlainText": false}' + type: string responses: '200': content: @@ -6487,8 +6520,8 @@ paths: name: pathQueryId required: true schema: - default: GYBpHkmyXjeuX9IeNJmweA - example: GYBpHkmyXjeuX9IeNJmweA + default: lc85bOG5T3IIS4u485VtBg + example: lc85bOG5T3IIS4u485VtBg type: string - in: query name: variables diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index 46c51c9..00f0edb 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -1703,6 +1703,7 @@ components: - Sparkle - Conversation - List + - Community type: string landingUrl: $ref: '#/components/schemas/SocialContextLandingUrl' @@ -3211,7 +3212,7 @@ components: type: apiKey UserAgent: description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like - Gecko) Chrome/129.0.0.0 Safari/537.36 + Gecko) Chrome/130.0.0.0 Safari/537.36 in: header name: user-agent type: apiKey @@ -4002,8 +4003,8 @@ paths: name: pathQueryId required: true schema: - default: QUjXply7fA7fk05FRyajEg - example: QUjXply7fA7fk05FRyajEg + default: L7vvM2UluPgWOW4GDvWyvw + example: L7vvM2UluPgWOW4GDvWyvw type: string - content: application/json: @@ -4894,8 +4895,8 @@ paths: name: pathQueryId required: true schema: - default: LLkw5EcVutJL6y-2gkz22A - example: LLkw5EcVutJL6y-2gkz22A + default: riUYr3PwuHNe4tCmzjPNrg + example: riUYr3PwuHNe4tCmzjPNrg type: string - content: application/json: @@ -4925,10 +4926,22 @@ paths: application/json: schema: properties: + articles_preview_enabled: + default: true + example: true + type: boolean c9s_tweet_anatomy_moderator_badge_enabled: default: true example: true type: boolean + communities_web_enable_tweet_community_results_fetch: + default: true + example: true + type: boolean + creator_subscriptions_quote_tweet_preview_enabled: + default: false + example: false + type: boolean creator_subscriptions_tweet_preview_api_enabled: default: true example: true @@ -4973,14 +4986,14 @@ paths: default: true example: true type: boolean - responsive_web_media_download_video_enabled: - default: false - example: false - type: boolean responsive_web_twitter_article_tweet_consumption_enabled: default: true example: true type: boolean + rweb_tipjar_consumption_enabled: + default: true + example: true + type: boolean rweb_video_timestamps_enabled: default: true example: true @@ -4997,10 +5010,6 @@ paths: default: true example: true type: boolean - tweetypie_unmention_optimization_enabled: - default: true - example: true - type: boolean verified_phone_label_enabled: default: false example: false @@ -5010,26 +5019,28 @@ paths: example: true type: boolean required: + - rweb_tipjar_consumption_enabled - responsive_web_graphql_exclude_directive_enabled - verified_phone_label_enabled - creator_subscriptions_tweet_preview_api_enabled - responsive_web_graphql_timeline_navigation_enabled - responsive_web_graphql_skip_user_profile_image_extensions_enabled + - communities_web_enable_tweet_community_results_fetch - c9s_tweet_anatomy_moderator_badge_enabled - - tweetypie_unmention_optimization_enabled + - articles_preview_enabled - responsive_web_edit_tweet_api_enabled - graphql_is_translatable_rweb_tweet_is_translatable_enabled - view_counts_everywhere_api_enabled - longform_notetweets_consumption_enabled - responsive_web_twitter_article_tweet_consumption_enabled - tweet_awards_web_tipping_enabled + - creator_subscriptions_quote_tweet_preview_enabled - freedom_of_speech_not_reach_fetch_enabled - standardized_nudges_misinfo - tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled - rweb_video_timestamps_enabled - longform_notetweets_rich_text_read_enabled - longform_notetweets_inline_media_enabled - - responsive_web_media_download_video_enabled - responsive_web_enhance_cards_enabled type: object in: query @@ -5668,8 +5679,8 @@ paths: name: pathQueryId required: true schema: - default: DiTkXJgLqBBxCs7zaYsbtA - example: DiTkXJgLqBBxCs7zaYsbtA + default: HyuV8ml52TYmyUjyrDq1CQ + example: HyuV8ml52TYmyUjyrDq1CQ type: string - content: application/json: @@ -5876,8 +5887,8 @@ paths: name: pathQueryId required: true schema: - default: HJFjzBgCs16TqxewQOeLNg - example: HJFjzBgCs16TqxewQOeLNg + default: E6AtJXVPtK7nIHAntKc5fA + example: E6AtJXVPtK7nIHAntKc5fA type: string - content: application/json: @@ -5914,8 +5925,8 @@ paths: - includePromotedContent - latestControlAvailable - requestContext - - withCommunity - seenTweetIds + - withCommunity type: object in: query name: variables @@ -6089,8 +6100,8 @@ paths: name: pathQueryId required: true schema: - default: aeJWz--kknVBOl7wQ7gh7Q - example: aeJWz--kknVBOl7wQ7gh7Q + default: px6_YxfWkXo0odY84iqqmw + example: px6_YxfWkXo0odY84iqqmw type: string - content: application/json: @@ -6260,6 +6271,20 @@ paths: in: query name: features required: true + - content: + application/json: + schema: + properties: + withArticlePlainText: + default: false + example: false + type: boolean + required: + - withArticlePlainText + type: object + in: query + name: fieldToggles + required: true responses: '200': content: @@ -6305,8 +6330,8 @@ paths: name: pathQueryId required: true schema: - default: Pa45JvqZuKcW1plybfgBlQ - example: Pa45JvqZuKcW1plybfgBlQ + default: f-Lsj0rHCztXcgdo585UUw + example: f-Lsj0rHCztXcgdo585UUw type: string - content: application/json: @@ -6564,8 +6589,8 @@ paths: name: pathQueryId required: true schema: - default: 8019obfgnveiPiJuS2Rtow - example: 8019obfgnveiPiJuS2Rtow + default: rPcOnVhyaTBQrVgPuY7x7A + example: rPcOnVhyaTBQrVgPuY7x7A type: string - content: application/json: @@ -6760,8 +6785,8 @@ paths: name: pathQueryId required: true schema: - default: UN1i3zUiCWa-6r-Uaho4fw - example: UN1i3zUiCWa-6r-Uaho4fw + default: MJpyQGqgklrVl_0X9gNy3A + example: MJpyQGqgklrVl_0X9gNy3A type: string - content: application/json: @@ -6961,8 +6986,8 @@ paths: name: pathQueryId required: true schema: - default: QuBlQ6SxNAQCt6-kBiCXCQ - example: QuBlQ6SxNAQCt6-kBiCXCQ + default: nBS-WpgA6ZG0CyNHD517JQ + example: nBS-WpgA6ZG0CyNHD517JQ type: string - content: application/json: @@ -6976,6 +7001,10 @@ paths: default: true example: true type: boolean + rankingMode: + default: Relevance + example: Relevance + type: string referrer: default: home example: home @@ -6992,10 +7021,6 @@ paths: default: true example: true type: boolean - withV2Timeline: - default: true - example: true - type: boolean withVoice: default: true example: true @@ -7008,12 +7033,12 @@ paths: - focalTweetId - referrer - with_rux_injections + - rankingMode - includePromotedContent - withCommunity - withQuickPromoteEligibilityTweetFields - withBirdwatchNotes - withVoice - - withV2Timeline type: object in: query name: variables @@ -7154,9 +7179,19 @@ paths: default: true example: true type: boolean + withDisallowedReplyControls: + default: false + example: false + type: boolean + withGrokAnalyze: + default: false + example: false + type: boolean required: - withArticleRichContentState - withArticlePlainText + - withGrokAnalyze + - withDisallowedReplyControls type: object in: query name: fieldToggles @@ -7631,8 +7666,8 @@ paths: name: pathQueryId required: true schema: - default: Yka-W8dz7RaEuQNkroPkYw - example: Yka-W8dz7RaEuQNkroPkYw + default: BQ6xjFU6Mgm-WhEP3OiT9w + example: BQ6xjFU6Mgm-WhEP3OiT9w type: string - content: application/json: @@ -7642,13 +7677,8 @@ paths: default: elonmusk example: elonmusk type: string - withSafetyModeUserFields: - default: true - example: true - type: boolean required: - screen_name - - withSafetyModeUserFields type: object in: query name: variables @@ -7982,8 +8012,8 @@ paths: name: pathQueryId required: true schema: - default: dexO_2tohK86JDudXXG3Yw - example: dexO_2tohK86JDudXXG3Yw + default: HaouMjBviBKKTYZGV_9qtg + example: HaouMjBviBKKTYZGV_9qtg type: string - content: application/json: @@ -8153,6 +8183,20 @@ paths: in: query name: features required: true + - content: + application/json: + schema: + properties: + withArticlePlainText: + default: false + example: false + type: boolean + required: + - withArticlePlainText + type: object + in: query + name: fieldToggles + required: true responses: '200': content: @@ -8198,8 +8242,8 @@ paths: name: pathQueryId required: true schema: - default: E3opETHurmVJflFsUBVuUQ - example: E3opETHurmVJflFsUBVuUQ + default: Tg82Ez_kxVaJf7OPbUdbCg + example: Tg82Ez_kxVaJf7OPbUdbCg type: string - content: application/json: @@ -8364,6 +8408,20 @@ paths: in: query name: features required: true + - content: + application/json: + schema: + properties: + withArticlePlainText: + default: false + example: false + type: boolean + required: + - withArticlePlainText + type: object + in: query + name: fieldToggles + required: true responses: '200': content: @@ -8409,8 +8467,8 @@ paths: name: pathQueryId required: true schema: - default: bt4TKuFz4T7Ckk-VvQVSow - example: bt4TKuFz4T7Ckk-VvQVSow + default: HmWGzuzXoI6uFqqX6QNhEg + example: HmWGzuzXoI6uFqqX6QNhEg type: string - content: application/json: @@ -8575,6 +8633,20 @@ paths: in: query name: features required: true + - content: + application/json: + schema: + properties: + withArticlePlainText: + default: false + example: false + type: boolean + required: + - withArticlePlainText + type: object + in: query + name: fieldToggles + required: true responses: '200': content: @@ -8620,8 +8692,8 @@ paths: name: pathQueryId required: true schema: - default: GYBpHkmyXjeuX9IeNJmweA - example: GYBpHkmyXjeuX9IeNJmweA + default: lc85bOG5T3IIS4u485VtBg + example: lc85bOG5T3IIS4u485VtBg type: string - content: application/json: diff --git a/src/config/placeholder.json b/src/config/placeholder.json index 1bedf9b..bd3e3b0 100644 --- a/src/config/placeholder.json +++ b/src/config/placeholder.json @@ -1,13 +1,13 @@ { "HomeTimeline": { - "queryId": "HJFjzBgCs16TqxewQOeLNg", + "queryId": "E6AtJXVPtK7nIHAntKc5fA", "variables": { "count": 20, "includePromotedContent": true, "latestControlAvailable": true, "requestContext": "launch", - "withCommunity": true, - "seenTweetIds": ["1349129669258448897"] + "seenTweetIds": ["1349129669258448897"], + "withCommunity": true }, "features": { "rweb_tipjar_consumption_enabled": true, @@ -36,7 +36,7 @@ } }, "HomeLatestTimeline": { - "queryId": "DiTkXJgLqBBxCs7zaYsbtA", + "queryId": "HyuV8ml52TYmyUjyrDq1CQ", "variables": { "count": 20, "includePromotedContent": true, @@ -71,7 +71,7 @@ } }, "ListLatestTweetsTimeline": { - "queryId": "Pa45JvqZuKcW1plybfgBlQ", + "queryId": "f-Lsj0rHCztXcgdo585UUw", "variables": { "listId": "1539453138322673664", "count": 20 @@ -103,10 +103,9 @@ } }, "UserByScreenName": { - "queryId": "Yka-W8dz7RaEuQNkroPkYw", + "queryId": "BQ6xjFU6Mgm-WhEP3OiT9w", "variables": { - "screen_name": "elonmusk", - "withSafetyModeUserFields": true + "screen_name": "elonmusk" }, "features": { "hidden_profile_subscriptions_enabled": true, @@ -145,7 +144,7 @@ } }, "UsersByRestIds": { - "queryId": "GYBpHkmyXjeuX9IeNJmweA", + "queryId": "lc85bOG5T3IIS4u485VtBg", "variables": { "userIds": ["44196397"] }, @@ -165,7 +164,7 @@ "features": {} }, "UserTweets": { - "queryId": "E3opETHurmVJflFsUBVuUQ", + "queryId": "Tg82Ez_kxVaJf7OPbUdbCg", "variables": { "userId": "44196397", "count": 40, @@ -198,10 +197,13 @@ "longform_notetweets_rich_text_read_enabled": true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false + }, + "fieldToggles": { + "withArticlePlainText": false } }, "UserTweetsAndReplies": { - "queryId": "bt4TKuFz4T7Ckk-VvQVSow", + "queryId": "HmWGzuzXoI6uFqqX6QNhEg", "variables": { "userId": "44196397", "count": 40, @@ -234,6 +236,9 @@ "longform_notetweets_rich_text_read_enabled": true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false + }, + "fieldToggles": { + "withArticlePlainText": false } }, "UserHighlightsTweets": { @@ -271,7 +276,7 @@ } }, "UserMedia": { - "queryId": "dexO_2tohK86JDudXXG3Yw", + "queryId": "HaouMjBviBKKTYZGV_9qtg", "variables": { "userId": "44196397", "count": 40, @@ -305,10 +310,13 @@ "longform_notetweets_rich_text_read_enabled": true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false + }, + "fieldToggles": { + "withArticlePlainText": false } }, "Likes": { - "queryId": "aeJWz--kknVBOl7wQ7gh7Q", + "queryId": "px6_YxfWkXo0odY84iqqmw", "variables": { "userId": "44196397", "count": 20, @@ -342,10 +350,13 @@ "longform_notetweets_rich_text_read_enabled": true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false + }, + "fieldToggles": { + "withArticlePlainText": false } }, "Bookmarks": { - "queryId": "QUjXply7fA7fk05FRyajEg", + "queryId": "L7vvM2UluPgWOW4GDvWyvw", "variables": { "count": 20, "includePromotedContent": true @@ -378,17 +389,17 @@ } }, "TweetDetail": { - "queryId": "QuBlQ6SxNAQCt6-kBiCXCQ", + "queryId": "nBS-WpgA6ZG0CyNHD517JQ", "variables": { "focalTweetId": "1349129669258448897", "referrer": "home", "with_rux_injections": false, + "rankingMode": "Relevance", "includePromotedContent": true, "withCommunity": true, "withQuickPromoteEligibilityTweetFields": true, "withBirdwatchNotes": true, - "withVoice": true, - "withV2Timeline": true + "withVoice": true }, "features": { "rweb_tipjar_consumption_enabled": true, @@ -417,7 +428,9 @@ }, "fieldToggles": { "withArticleRichContentState": true, - "withArticlePlainText": false + "withArticlePlainText": false, + "withGrokAnalyze": false, + "withDisallowedReplyControls": false } }, "TweetResultByRestId": { @@ -461,7 +474,7 @@ } }, "SearchTimeline": { - "queryId": "UN1i3zUiCWa-6r-Uaho4fw", + "queryId": "MJpyQGqgklrVl_0X9gNy3A", "variables": { "rawQuery": "elonmusk", "count": 20, @@ -495,38 +508,40 @@ } }, "Favoriters": { - "queryId": "LLkw5EcVutJL6y-2gkz22A", + "queryId": "riUYr3PwuHNe4tCmzjPNrg", "variables": { "tweetId": "1349129669258448897", "count": 20, "includePromotedContent": true }, "features": { + "rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": true, "verified_phone_label_enabled": false, "creator_subscriptions_tweet_preview_api_enabled": true, "responsive_web_graphql_timeline_navigation_enabled": true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "communities_web_enable_tweet_community_results_fetch": true, "c9s_tweet_anatomy_moderator_badge_enabled": true, - "tweetypie_unmention_optimization_enabled": true, + "articles_preview_enabled": true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": true, "responsive_web_twitter_article_tweet_consumption_enabled": true, "tweet_awards_web_tipping_enabled": false, + "creator_subscriptions_quote_tweet_preview_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": true, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": true, "rweb_video_timestamps_enabled": true, "longform_notetweets_rich_text_read_enabled": true, "longform_notetweets_inline_media_enabled": true, - "responsive_web_media_download_video_enabled": false, "responsive_web_enhance_cards_enabled": false } }, "Retweeters": { - "queryId": "8019obfgnveiPiJuS2Rtow", + "queryId": "rPcOnVhyaTBQrVgPuY7x7A", "variables": { "tweetId": "1349129669258448897", "count": 20, @@ -939,7 +954,7 @@ "queryId": "Z2BA99jFw6TxaJM5v7Irmg" }, "ExplorePage": { - "queryId": "IK_dxB178qS4T8cvA2G_UA", + "queryId": "8YAZZkK7Ca09HoBzmd-9GQ", "features": { "rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": true, @@ -973,7 +988,7 @@ "queryId": "xfgycRkhqXy90CmTQZ7Kig" }, "CommunitiesRankedTimeline": { - "queryId": "ruTkdk9a7c2U99VzD4MtMw", + "queryId": "NVJIUjvGDC3o814fGgkU3g", "features": { "rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": true, @@ -998,10 +1013,14 @@ "longform_notetweets_rich_text_read_enabled": true, "longform_notetweets_inline_media_enabled": true, "responsive_web_enhance_cards_enabled": false + }, + "variables": { + "withCommunity": true, + "count": 20 } }, "BirdwatchFetchGlobalTimeline": { - "queryId": "Hu5em3YzOCFtiBOxT3qvEQ", + "queryId": "9TNlnKM4cSOwNE4txrtnJQ", "features": { "rweb_tipjar_consumption_enabled": true, "responsive_web_graphql_exclude_directive_enabled": true, @@ -1066,5 +1085,17 @@ "FetchDraftTweets": { "queryId": "fMp3izG_gCZKVk3Aa1vVKw", "ascending": false + }, + "useFetchAnalyticsQuery": { + "queryId": "5JkoDLRvQrXv2QV4U5gKFg" + }, + "QuickPromoteEligibility": { + "queryId": "LtpCXh66W-uXh7u7XSRA8Q" + }, + "TweetActivityQuery": { + "queryId": "vnwexpl0q33_Bky-SROVww", + "features": { + "responsive_web_tweet_analytics_m3_enabled": false + } } } diff --git a/src/openapi/schemas/content.yaml b/src/openapi/schemas/content.yaml index cbd4540..fb968d0 100644 --- a/src/openapi/schemas/content.yaml +++ b/src/openapi/schemas/content.yaml @@ -263,6 +263,7 @@ components: - "Sparkle" - "Conversation" - "List" + - "Community" text: type: string landingUrl: diff --git a/tools/generater.py b/tools/generater.py index 42308fd..ca9c405 100644 --- a/tools/generater.py +++ b/tools/generater.py @@ -16,7 +16,7 @@ from rich.rule import Rule def main(): print(Rule(characters="=")) print( - "Chrome DevTools の Network タブで「表示されているものをすべてfetch としてコピー」したコードを`input.js`に貼り付けてください。" + "Chrome DevTools の Network タブで検索窓に「graphql」と入力し「表示されているものをすべてfetch としてコピー」したコードを`input.js`に貼り付けてください。" ) print("Enter を押すと続行します。") print(Rule(characters="=")) @@ -68,6 +68,7 @@ def main(): body_json = json.loads(body_json_str) features = body_json.get("features", None) variables = body_json.get("variables", None) + fieldToggles = body_json.get("fieldToggles", None) else: # GET リクエストの場合、まず URL を抽出 url_match = re.search(r'"(https?://[^"]+)"', fetch_code) @@ -88,16 +89,38 @@ def main(): features_json_str = query_dict.get("features", [None])[0] if features_json_str is None: features = None - variables = None else: try: features = json.loads(features_json_str) except json.JSONDecodeError: + features = None print( "features の JSON パースに失敗しました。features は None として続行します。" ) - features = None + + variables_json_str = query_dict.get("variables", [None])[0] + if variables_json_str is None: + variables = None + else: + try: + variables = json.loads(variables_json_str) + except json.JSONDecodeError: variables = None + print( + "variables の JSON パースに失敗しました。variables は None として続行します。" + ) + + fieldToggles_json_str = query_dict.get("fieldToggles", [None])[0] + if fieldToggles_json_str is None: + fieldToggles = None + else: + try: + fieldToggles = json.loads(fieldToggles_json_str) + except json.JSONDecodeError: + fieldToggles = None + print( + "fieldToggles の JSON パースに失敗しました。fieldToggles は None として続行します。" + ) with open("./src/config/placeholder.json", "r") as f: placeholder = json.load(f) @@ -123,6 +146,8 @@ def main(): placeholder[endpoint]["queryId"] = query_id if features: placeholder[endpoint]["features"] = features + if fieldToggles: + placeholder[endpoint]["fieldToggles"] = fieldToggles json.dump(placeholder, f, indent=4)