From 26908878c17f59dad33b2f1e50d17e8f97035bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Tue, 18 Apr 2023 09:23:53 +0900 Subject: [PATCH] add builder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- .gitignore | 1 + dist/openapi-3.0.yaml | 101 ++ dist/path/follow.yaml | 133 +++ dist/path/timeline.yaml | 258 +++++ dist/path/user.yaml | 89 ++ dist/path/usertweets.yaml | 353 ++++++ dist/schemas/content.yaml | 105 ++ dist/schemas/general.yaml | 13 + dist/schemas/instruction.yaml | 67 ++ dist/schemas/timeline.yaml | 25 + dist/schemas/tweet.yaml | 145 +++ dist/schemas/typename.yaml | 17 + dist/schemas/user.yaml | 214 ++++ openapi/openapi-3.0.yaml | 1549 -------------------------- requirements.txt | Bin 0 -> 28 bytes src/config/header.yaml | 41 + src/config/parameters.yaml | 30 + src/config/placeholder.json | 234 ++++ src/openapi/openapi-3.0.yaml | 94 ++ src/openapi/path/follow.yaml | 27 + src/openapi/path/timeline.yaml | 104 ++ src/openapi/path/user.yaml | 36 + src/openapi/path/usertweets.yaml | 98 ++ src/openapi/schemas/content.yaml | 110 ++ src/openapi/schemas/general.yaml | 12 + src/openapi/schemas/instruction.yaml | 70 ++ src/openapi/schemas/timeline.yaml | 27 + src/openapi/schemas/tweet.yaml | 152 +++ src/openapi/schemas/typename.yaml | 19 + src/openapi/schemas/user.yaml | 219 ++++ tools/build.py | 92 ++ 31 files changed, 2886 insertions(+), 1549 deletions(-) create mode 100644 .gitignore create mode 100644 dist/openapi-3.0.yaml create mode 100644 dist/path/follow.yaml create mode 100644 dist/path/timeline.yaml create mode 100644 dist/path/user.yaml create mode 100644 dist/path/usertweets.yaml create mode 100644 dist/schemas/content.yaml create mode 100644 dist/schemas/general.yaml create mode 100644 dist/schemas/instruction.yaml create mode 100644 dist/schemas/timeline.yaml create mode 100644 dist/schemas/tweet.yaml create mode 100644 dist/schemas/typename.yaml create mode 100644 dist/schemas/user.yaml delete mode 100644 openapi/openapi-3.0.yaml create mode 100644 requirements.txt create mode 100644 src/config/header.yaml create mode 100644 src/config/parameters.yaml create mode 100644 src/config/placeholder.json create mode 100644 src/openapi/openapi-3.0.yaml create mode 100644 src/openapi/path/follow.yaml create mode 100644 src/openapi/path/timeline.yaml create mode 100644 src/openapi/path/user.yaml create mode 100644 src/openapi/path/usertweets.yaml create mode 100644 src/openapi/schemas/content.yaml create mode 100644 src/openapi/schemas/general.yaml create mode 100644 src/openapi/schemas/instruction.yaml create mode 100644 src/openapi/schemas/timeline.yaml create mode 100644 src/openapi/schemas/tweet.yaml create mode 100644 src/openapi/schemas/typename.yaml create mode 100644 src/openapi/schemas/user.yaml create mode 100644 tools/build.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b694934 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.venv \ No newline at end of file diff --git a/dist/openapi-3.0.yaml b/dist/openapi-3.0.yaml new file mode 100644 index 0000000..f28330c --- /dev/null +++ b/dist/openapi-3.0.yaml @@ -0,0 +1,101 @@ +components: + schemas: {} + securitySchemes: + ActiveUser: + description: 'yes' + in: header + name: x-twitter-active-user + type: apiKey + AuthType: + description: OAuth2Session + in: header + name: x-twitter-auth-type + type: apiKey + BearerAuth: + description: AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA + scheme: bearer + type: http + ClientLanguage: + description: en + in: header + name: x-twitter-client-language + type: apiKey + CookieAuthToken: + in: cookie + name: auth_token + type: apiKey + CookieCt0: + in: cookie + name: ct0 + type: apiKey + CsrfToken: + in: header + name: x-csrf-token + type: apiKey +info: + contact: + email: yuki@yuki0311.com + description: Twitter OpenAPI(Swagger) specification + license: + name: GNU Affero General Public License v3. + url: https://raw.githubusercontent.com/fa0311/twitter-openapi/main/LICENSE.txt + termsOfService: https://github.com/fa0311 + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: + /2TemLyqrMpTeAmysdbnVqw/ListLatestTweetsTimeline: + $ref: ./path/timeline.yaml#/paths/~12TemLyqrMpTeAmysdbnVqw~1ListLatestTweetsTimeline + /5fmEkRT-1AdHqEsbVgehMg/Likes: + $ref: ./path/usertweets.yaml#/paths/~15fmEkRT-1AdHqEsbVgehMg~1Likes + /HCosKfLNW1AcOo3la3mMgg/HomeTimeline: + $ref: ./path/timeline.yaml#/paths/~1HCosKfLNW1AcOo3la3mMgg~1HomeTimeline + /HuTx74BxAnezK1gWvYY7zg/UserTweets: + $ref: ./path/usertweets.yaml#/paths/~1HuTx74BxAnezK1gWvYY7zg~1UserTweets + /RIWc55YCNyUJ-U3HHGYkdg/UserTweetsAndReplies: + $ref: ./path/usertweets.yaml#/paths/~1RIWc55YCNyUJ-U3HHGYkdg~1UserTweetsAndReplies + /YqiE3JL1KNgf9nSljYdxaA/UserMedia: + $ref: ./path/usertweets.yaml#/paths/~1YqiE3JL1KNgf9nSljYdxaA~1UserMedia + /sLVLhk0bGj3MVFEKTdax1w/UserByScreenName: + $ref: ./path/user.yaml#/paths/~1sLVLhk0bGj3MVFEKTdax1w~1UserByScreenName + /zhX91JE87mWvfprhYE97xA/HomeLatestTimeline: + $ref: ./path/timeline.yaml#/paths/~1zhX91JE87mWvfprhYE97xA~1HomeLatestTimeline + /{{FollowersQuery}}/Followers: + $ref: ./path/follow.yaml#/paths/~1{{FollowersQuery}}~1Followers + /{{FollowingQuery}}/Following: + $ref: ./path/follow.yaml#/paths/~1{{FollowingQuery}}~1Following +security: +- bearerAuth: [] +- CsrfToken: [] +- ActiveUser: [] +- AuthType: [] +- ClientLanguage: [] +- CookieAuthToken: [] +- CookieCt0: [] +servers: +- url: https://twitter.com/i/api/graphql +tags: +- description: timeline + name: timeline +- description: tweet + name: tweet +- description: user + name: user +- description: follow + name: follow +- description: search + name: search +- description: dm + name: dm +- description: settings + name: settings +- description: notify + name: notify +- description: login session required + name: login required +- description: graphql + name: graphql +- description: login flow + name: login-flow +- description: report flow + name: report-flow diff --git a/dist/path/follow.yaml b/dist/path/follow.yaml new file mode 100644 index 0000000..766bc97 --- /dev/null +++ b/dist/path/follow.yaml @@ -0,0 +1,133 @@ +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: + /{{FollowersQuery}}/Followers: + get: + description: get user list of following + operationId: getFollowing + parameters: + - in: query + name: variables + required: true + schema: + example: '{{Variables}}' + type: string + - in: query + name: features + required: true + schema: + example: '{{Features}}' + type: string + - in: query + name: queryId + required: true + schema: + default: '{{Query}}' + example: '{{Query}}' + type: string + responses: + '200': + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - follow + - graphql + /{{FollowingQuery}}/Following: + get: + description: get user list of followers + operationId: getFollowers + parameters: + - in: query + name: variables + required: true + schema: + example: '{{Variables}}' + type: string + - in: query + name: features + required: true + schema: + example: '{{Features}}' + type: string + - in: query + name: queryId + required: true + schema: + default: '{{Query}}' + example: '{{Query}}' + type: string + responses: + '200': + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - follow + - graphql diff --git a/dist/path/timeline.yaml b/dist/path/timeline.yaml new file mode 100644 index 0000000..7ff546e --- /dev/null +++ b/dist/path/timeline.yaml @@ -0,0 +1,258 @@ +components: + schemas: + HomeTimelineHome: + properties: + home_timeline_urt: + $ref: ./../schemas/timeline.yaml#/components/schemas/Timeline + required: + - home_timeline_urt + HomeTimelineResponseData: + properties: + home: + $ref: '#/components/schemas/HomeTimelineHome' + required: + - home + ListTweetsTimeline: + properties: + timeline: + $ref: ./../schemas/timeline.yaml#/components/schemas/Timeline + required: + - timeline + ListTweetsTimelineData: + properties: + home: + $ref: '#/components/schemas/ListTweetsTimelineList' + required: + - list + ListTweetsTimelineList: + properties: + tweets_timeline: + $ref: '#/components/schemas/ListTweetsTimeline' + required: + - tweets_timeline + ListTweetsTimelineResponse: + properties: + data: + $ref: '#/components/schemas/ListTweetsTimelineData' + required: + - data + TimelineResponse: + properties: + data: + $ref: '#/components/schemas/HomeTimelineResponseData' + required: + - data +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: + /2TemLyqrMpTeAmysdbnVqw/ListLatestTweetsTimeline: + get: + description: get tweet list of timeline + operationId: getListLatestTweetsTimeline + parameters: + - in: query + name: variables + required: true + schema: + example: '{"listId": "53044119", "count": 20}' + type: string + - in: query + name: features + required: true + schema: + example: '{{Features}}' + type: string + - in: query + name: queryId + required: true + schema: + default: 2TemLyqrMpTeAmysdbnVqw + example: 2TemLyqrMpTeAmysdbnVqw + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListTweetsTimelineResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - timeline + - login-required + - graphql + /HCosKfLNW1AcOo3la3mMgg/HomeTimeline: + get: + description: get tweet list of timeline + operationId: getHomeTimeline + parameters: + - in: query + name: variables + required: true + schema: + example: '{"count": 40, "includePromotedContent": true, "latestControlAvailable": + true, "withCommunity": true}' + type: string + - in: query + name: features + required: true + schema: + example: '{{Features}}' + type: string + - in: query + name: queryId + required: true + schema: + default: HCosKfLNW1AcOo3la3mMgg + example: HCosKfLNW1AcOo3la3mMgg + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TimelineResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - timeline + - login-required + - graphql + /zhX91JE87mWvfprhYE97xA/HomeLatestTimeline: + get: + description: get tweet list of timeline + operationId: getHomeLatestTimeline + parameters: + - in: query + name: variables + required: true + schema: + example: '{"count": 20, "includePromotedContent": true, "latestControlAvailable": + true, "requestContext": "launch"}' + type: string + - in: query + name: features + required: true + schema: + example: '{{Features}}' + type: string + - in: query + name: queryId + required: true + schema: + default: zhX91JE87mWvfprhYE97xA + example: zhX91JE87mWvfprhYE97xA + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TimelineResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - timeline + - login-required + - graphql diff --git a/dist/path/user.yaml b/dist/path/user.yaml new file mode 100644 index 0000000..57a04c8 --- /dev/null +++ b/dist/path/user.yaml @@ -0,0 +1,89 @@ +components: + schemas: + UserResponse: + properties: + data: + $ref: '#/components/schemas/UserResponseData' + required: + - data + UserResponseData: + properties: + user: + $ref: ./../schemas/user.yaml#/components/schemas/UserResults + required: + - user +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: + /sLVLhk0bGj3MVFEKTdax1w/UserByScreenName: + get: + description: get user by screen name + operationId: getUserByScreenName + parameters: + - in: query + name: variables + required: true + schema: + example: '{"screen_name": "elonmusk", "withSafetyModeUserFields": true}' + type: string + - in: query + name: features + required: true + schema: + example: '{"blue_business_profile_image_shape_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "responsive_web_graphql_timeline_navigation_enabled": true}' + type: string + - in: query + name: queryId + required: true + schema: + default: sLVLhk0bGj3MVFEKTdax1w + example: sLVLhk0bGj3MVFEKTdax1w + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UserResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - user + - graphql diff --git a/dist/path/usertweets.yaml b/dist/path/usertweets.yaml new file mode 100644 index 0000000..0403d7a --- /dev/null +++ b/dist/path/usertweets.yaml @@ -0,0 +1,353 @@ +components: + schemas: + UserTweetsData: + properties: + user: + $ref: '#/components/schemas/UserTweetsUser' + required: + - user + UserTweetsResponse: + properties: + data: + $ref: '#/components/schemas/UserTweetsData' + required: + - data + UserTweetsResult: + properties: + __typename: + $ref: ./../schemas/typename.yaml#/components/schemas/TypeName + timeline_v2: + $ref: ./../schemas/timeline.yaml#/components/schemas/TimelineV2 + required: + - __typename + - timeline_v2 + UserTweetsUser: + properties: + result: + $ref: '#/components/schemas/UserTweetsResult' + required: + - result +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: + /5fmEkRT-1AdHqEsbVgehMg/Likes: + get: + description: get user likes tweets + operationId: getLikes + parameters: + - in: query + name: variables + required: true + schema: + example: '{"userId": "44196397", "count": 20, "includePromotedContent": + false, "withClientEventToken": false, "withBirdwatchNotes": false, "withVoice": + true, "withV2Timeline": true}' + type: string + - in: query + name: features + required: true + schema: + example: '{"blue_business_profile_image_shape_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "responsive_web_graphql_timeline_navigation_enabled": + true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_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, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": + false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled": + false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + type: string + - in: query + name: queryId + required: true + schema: + default: 5fmEkRT-1AdHqEsbVgehMg + example: 5fmEkRT-1AdHqEsbVgehMg + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UserTweetsResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - user + - graphql + /HuTx74BxAnezK1gWvYY7zg/UserTweets: + get: + description: get user tweets + operationId: getUserTweets + parameters: + - in: query + name: variables + required: true + schema: + example: '{"userId": "44196397", "count": 40, "includePromotedContent": + true, "withQuickPromoteEligibilityTweetFields": true, "withVoice": true, + "withV2Timeline": true}' + type: string + - in: query + name: features + required: true + schema: + example: '{"blue_business_profile_image_shape_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "responsive_web_graphql_timeline_navigation_enabled": + true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_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, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": + false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled": + false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + type: string + - in: query + name: queryId + required: true + schema: + default: HuTx74BxAnezK1gWvYY7zg + example: HuTx74BxAnezK1gWvYY7zg + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UserTweetsResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - user + - graphql + /RIWc55YCNyUJ-U3HHGYkdg/UserTweetsAndReplies: + get: + description: get user replies tweets + operationId: getUserTweetsAndReplies + parameters: + - in: query + name: variables + required: true + schema: + example: '{"userId": "44196397", "count": 40, "includePromotedContent": + true, "withCommunity": true, "withVoice": true, "withV2Timeline": true}' + type: string + - in: query + name: features + required: true + schema: + example: '{"blue_business_profile_image_shape_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "responsive_web_graphql_timeline_navigation_enabled": + true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_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, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": + false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled": + false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + type: string + - in: query + name: queryId + required: true + schema: + default: RIWc55YCNyUJ-U3HHGYkdg + example: RIWc55YCNyUJ-U3HHGYkdg + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UserTweetsResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - user + - graphql + /YqiE3JL1KNgf9nSljYdxaA/UserMedia: + get: + description: get user media tweets + operationId: getUserMedia + parameters: + - in: query + name: variables + required: true + schema: + example: '{"userId": "44196397", "count": 20, "includePromotedContent": + false, "withClientEventToken": false, "withBirdwatchNotes": false, "withVoice": + true, "withV2Timeline": true}' + type: string + - in: query + name: features + required: true + schema: + example: '{"blue_business_profile_image_shape_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "responsive_web_graphql_timeline_navigation_enabled": + true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_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, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": + false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled": + false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + type: string + - in: query + name: queryId + required: true + schema: + default: YqiE3JL1KNgf9nSljYdxaA + example: YqiE3JL1KNgf9nSljYdxaA + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UserTweetsResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - user + - graphql diff --git a/dist/schemas/content.yaml b/dist/schemas/content.yaml new file mode 100644 index 0000000..9818ad0 --- /dev/null +++ b/dist/schemas/content.yaml @@ -0,0 +1,105 @@ +components: + schemas: + ContentEntryType: + enum: + - TimelineTimelineItem + - TimelineTimelineCursor + - TimelineTimelineModule + type: string + ContentItemType: + enum: + - TimelineTweet + type: string + ContentUnion: + discriminator: + mapping": + TimelineTimelineCursor: '#/components/schemas/TimelineTimelineCursor' + TimelineTimelineItem: '#/components/schemas/TimelineTimelineItem' + TimelineTimelineModule: '#/components/schemas/TimelineTimelineModule' + propertyName: entryType + oneOf: + - $ref: '#/components/schemas/TimelineTimelineItem' + - $ref: '#/components/schemas/TimelineTimelineCursor' + - $ref: '#/components/schemas/TimelineTimelineModule' + ItemContent: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + itemType: + $ref: '#/components/schemas/ContentItemType' + type: string + socialContext: + properties: + contextType: + type: string + text: + type: string + type: + type: string + type: object + tweetDisplayType: + type: string + tweet_results: + $ref: '#/components/schemas/ItemResult' + required: + - __typename + - itemType + - tweetDisplayType + - tweet_results + ItemResult: + properties: + result: + $ref: ./tweet.yaml#/components/schemas/TweetUnion + required: + - result + TimelineTimelineCursor: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + cursorType: + enum: + - Top + - Bottom + type: string + entryType: + $ref: '#/components/schemas/ContentEntryType' + type: string + value: + type: string + required: + - __typename + - entryType + - cursorType + - value + TimelineTimelineItem: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + clientEventInfo: + type: object + entryType: + $ref: '#/components/schemas/ContentEntryType' + type: string + feedbackInfo: + type: object + itemContent: + $ref: '#/components/schemas/ItemContent' + required: + - __typename + - entryType + - itemContent + TimelineTimelineModule: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + entryType: + $ref: '#/components/schemas/ContentEntryType' + type: string + required: + - __typename + - entryType +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/dist/schemas/general.yaml b/dist/schemas/general.yaml new file mode 100644 index 0000000..7a64dcf --- /dev/null +++ b/dist/schemas/general.yaml @@ -0,0 +1,13 @@ +components: + schemas: + TwitterTimeFormat: + example: Sat Dec 31 23:59:59 +0000 2023 + pattern: ^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) + (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]) + ([+-][0-9]{4}) ([0-9]{4})$ + type: string +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/dist/schemas/instruction.yaml b/dist/schemas/instruction.yaml new file mode 100644 index 0000000..5097676 --- /dev/null +++ b/dist/schemas/instruction.yaml @@ -0,0 +1,67 @@ +components: + schemas: + InstructionType: + enum: + - TimelineAddEntries + - TimelineClearCache + - TimelinePinEntry + type: string + InstructionUnion: + discriminator: + mapping": + TimelineAddEntries: '#/components/schemas/TimelineAddEntries' + TimelineClearCache: '#/components/schemas/TimelineClearCache' + TimelinePinEntry: '#/components/schemas/TimelinePinEntry' + propertyName: type + oneOf: + - $ref: '#/components/schemas/TimelineAddEntries' + - $ref: '#/components/schemas/TimelineClearCache' + - $ref: '#/components/schemas/TimelinePinEntry' + TimelineAddEntries: + properties: + entries: + items: + $ref: '#/components/schemas/TimelineAddEntry' + type: array + type: + $ref: '#/components/schemas/InstructionType' + type: string + required: + - type + - entries + TimelineAddEntry: + properties: + content: + $ref: ./content.yaml#/components/schemas/ContentUnion + entryId: + pattern: ^[a-z\-]+[0-9]+$ + type: string + sortIndex: + pattern: '[0-9]+$' + type: string + required: + - content + - entryId + - sortIndex + TimelineClearCache: + properties: + type: + $ref: '#/components/schemas/InstructionType' + type: string + required: + - type + TimelinePinEntry: + properties: + entry: + $ref: '#/components/schemas/TimelineAddEntry' + type: + $ref: '#/components/schemas/InstructionType' + type: string + required: + - type + - entry +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/dist/schemas/timeline.yaml b/dist/schemas/timeline.yaml new file mode 100644 index 0000000..b2b721e --- /dev/null +++ b/dist/schemas/timeline.yaml @@ -0,0 +1,25 @@ +components: + schemas: + Timeline: + properties: + instructions: + items: + $ref: ./../schemas/instruction.yaml#/components/schemas/InstructionUnion + type: array + metadata: + type: object + responseObjects: + type: object + required: + - instructions + TimelineV2: + properties: + timeline: + $ref: '#/components/schemas/Timeline' + required: + - timeline +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/dist/schemas/tweet.yaml b/dist/schemas/tweet.yaml new file mode 100644 index 0000000..aa3547a --- /dev/null +++ b/dist/schemas/tweet.yaml @@ -0,0 +1,145 @@ +components: + schemas: + Tweet: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + core: + $ref: ./user.yaml#/components/schemas/UserResultCore + edit_control: + properties: + edit_tweet_ids: + items: + pattern: ^[0-9]+$ + type: string + type: array + editable_until_msecs: + pattern: ^[0-9]+$ + type: string + edits_remaining: + pattern: ^[0-9]+$ + type: string + is_edit_eligible: + type: boolean + type: object + edit_prespective: + properties: + favorited: + type: boolean + retweeted: + type: boolean + type: object + is_translatable: + default: false + type: boolean + legacy: + $ref: '#/components/schemas/TweetLegacy' + rest_id: + pattern: ^[0-9]+$ + type: string + unmention_data: + type: object + views: + properties: + count: + pattern: ^[0-9]+$ + type: string + state: + type: string + type: object + required: + - rest_id + - core + - edit_control + - edit_prespective + - is_translatable + - legacy + - views + TweetLegacy: + properties: + bookmark_count: + type: integer + bookmarked: + type: boolean + conversation_id_str: + pattern: ^[0-9]+$ + type: string + created_at: + $ref: ./general.yaml#/components/schemas/TwitterTimeFormat + display_text_range: + items: + type: integer + type: array + entities: + type: object + favorite_count: + type: integer + favorited: + type: boolean + full_text: + type: string + id_str: + pattern: ^[0-9]+$ + type: string + is_quote_status: + type: boolean + lang: + type: string + possibly_sensitive: + default: false + type: boolean + possibly_sensitive_editable: + default: false + type: boolean + quote_count: + type: integer + reply_count: + type: integer + retweet_count: + type: integer + retweeted: + type: boolean + user_id_str: + pattern: ^[0-9]+$ + type: string + required: + - bookmark_count + - bookmarked + - conversation_id_str + - created_at + - display_text_range + - entities + - favorite_count + - favorited + - full_text + - is_quote_status + - lang + - quote_count + - reply_count + - retweet_count + - retweeted + - user_id_str + - id_str + TweetUnion: + discriminator: + mapping": + Tweet: '#/components/schemas/Tweet' + TweetWithVisibilityResults: '#/components/schemas/TweetWithVisibilityResults' + propertyName: __typename + oneOf: + - $ref: '#/components/schemas/Tweet' + - $ref: '#/components/schemas/TweetWithVisibilityResults' + TweetWithVisibilityResults: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + tweet: + $ref: '#/components/schemas/Tweet' + required: + - __typename + - tweet +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/dist/schemas/typename.yaml b/dist/schemas/typename.yaml new file mode 100644 index 0000000..1ac4fc4 --- /dev/null +++ b/dist/schemas/typename.yaml @@ -0,0 +1,17 @@ +components: + schemas: + TypeName: + enum: + - TimelineTweet + - TimelineTimelineItem + - TimelineTimelineCursor + - TweetWithVisibilityResults + - TimelineTimelineModule + - Tweet + - User + type: string +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/dist/schemas/user.yaml b/dist/schemas/user.yaml new file mode 100644 index 0000000..2b50a11 --- /dev/null +++ b/dist/schemas/user.yaml @@ -0,0 +1,214 @@ +components: + schemas: + User: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + affiliates_highlighted_label: + type: object + business_account: + type: object + has_graduated_access: + type: boolean + has_nft_avatar: + default: false + type: boolean + id: + pattern: ^[a-z\-]+[0-9]+$ + type: string + is_blue_verified: + default: false + type: boolean + legacy: + $ref: '#/components/schemas/UserLegacy' + rest_id: + pattern: ^[0-9]+$ + type: string + super_follow_eligible: + default: false + type: boolean + super_followed_by: + default: false + type: boolean + super_following: + default: false + type: boolean + required: + - __typename + - affiliates_highlighted_label + - has_graduated_access + - id + - is_blue_verified + - legacy + - rest_id + - super_follow_eligible + - super_followed_by + - super_following + UserLegacy: + properties: + blocked_by: + default: false + type: boolean + blocking: + default: false + type: boolean + can_dm: + default: false + type: boolean + can_media_tag: + default: false + type: boolean + created_at: + $ref: ./general.yaml#/components/schemas/TwitterTimeFormat + default_profile: + default: false + type: boolean + default_profile_image: + default: false + type: boolean + description: + type: string + entities: + type: object + fast_followers_count: + type: integer + favourites_count: + default: 0 + type: integer + follow_request_sent: + default: false + type: boolean + followed_by: + default: false + type: boolean + followers_count: + default: 0 + type: integer + following: + default: false + type: boolean + friends_count: + default: 0 + type: integer + has_custom_timelines: + default: false + type: boolean + is_translator: + default: false + type: boolean + listed_count: + default: 0 + type: integer + location: + type: string + media_count: + default: 0 + type: integer + muting: + default: false + type: boolean + name: + type: string + normal_followers_count: + default: 0 + type: integer + notifications: + default: false + type: boolean + pinned_tweet_ids_str: + items: + type: string + type: array + possibly_sensitive: + default: false + type: boolean + profile_banner_extensions: + type: object + profile_banner_url: + format: uri + type: string + profile_image_extensions: + type: object + profile_image_url_https: + format: uri + type: string + profile_interstitial_type: + type: string + protected: + default: false + type: boolean + screen_name: + type: string + statuses_count: + default: 0 + type: integer + translator_type: + type: string + url: + type: string + verified: + type: boolean + want_retweets: + default: false + type: boolean + required: + - blocked_by + - blocking + - can_dm + - can_media_tag + - created_at + - default_profile + - default_profile_image + - description + - entities + - fast_followers_count + - favourites_count + - follow_request_sent + - followed_by + - followers_count + - following + - friends_count + - has_custom_timelines + - is_translator + - listed_count + - location + - media_count + - muting + - name + - normal_followers_count + - notifications + - pinned_tweet_ids_str + - possibly_sensitive + - profile_image_url_https + - profile_interstitial_type + - protected + - screen_name + - status + - statuses_count + - translator_type + - verified + - want_retweets + UserResultCore: + properties: + user_results: + $ref: '#/components/schemas/UserResults' + required: + - user_results + UserResults: + properties: + result: + $ref: '#/components/schemas/UserUnion' + required: + - result + UserUnion: + discriminator: + mapping": + User: '#/components/schemas/User' + propertyName: __typename + oneOf: + - $ref: '#/components/schemas/User' +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/openapi/openapi-3.0.yaml b/openapi/openapi-3.0.yaml deleted file mode 100644 index 2635d75..0000000 --- a/openapi/openapi-3.0.yaml +++ /dev/null @@ -1,1549 +0,0 @@ -openapi: 3.0.3 -info: - title: Twitter OpenAPI - description: |- - Twitter OpenAPI(Swagger) specification - termsOfService: https://github.com/fa0311 - contact: - email: yuki@yuki0311.com - license: - name: GNU Affero General Public License v3. - url: https://raw.githubusercontent.com/fa0311/twitter-openapi/main/LICENSE.txt - version: 0.0.1 -servers: - - url: https://twitter.com/i/api/graphql - -paths: - # timeline - - /BntFPEOxs3GYdPaS6CjUcg/HomeTimeline: - get: - operationId: getHomeTimeline - description: get tweet list of timeline - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: '''{ - "count": 20, - "includePromotedContent": true, - "latestControlAvailable": true, - "requestContext": "launch", - "withCommunity": true, - "withDownvotePerspective": false, - "withReactionsMetadata": false, - "withReactionsPerspective": false - }''' - - name: features - in: query - required: true - schema: - type: string - example: '''{ - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "tweetypie_unmention_optimization_enabled": true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled": false, - "freedom_of_speech_not_reach_fetch_enabled": false, - "standardized_nudges_misinfo": true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, - "interactive_text_enabled": true, - "responsive_web_text_conversations_enabled": false, - "longform_notetweets_richtext_consumption_enabled": true, - "responsive_web_enhance_cards_enabled": false - }''' - - name: queryId - in: query - required: true - schema: - type: string - default: "BntFPEOxs3GYdPaS6CjUcg" - example: "'BntFPEOxs3GYdPaS6CjUcg'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/TimelineResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "timeline" - - "login-required" - - "graphql" - - /37RUvMgTiEVYYfrRTVDxpw/HomeLatestTimeline: - get: - operationId: getHomeLatestTimeline - description: get tweet list of timeline - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: '''{ - "count":20, - "includePromotedContent":true, - "latestControlAvailable":true, - "requestContext":"launch", - "withDownvotePerspective":false - }''' - - name: features - in: query - required: true - schema: - type: string - example: '''{ - "blue_business_profile_image_shape_enabled":true, - "responsive_web_graphql_exclude_directive_enabled":true, - "verified_phone_label_enabled":false, - "responsive_web_graphql_timeline_navigation_enabled":true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled":false, - "tweetypie_unmention_optimization_enabled":true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled":false, - "freedom_of_speech_not_reach_fetch_enabled":false, - "standardized_nudges_misinfo":true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled":false, - "interactive_text_enabled":true, - "responsive_web_text_conversations_enabled":false, - "longform_notetweets_rich_text_read_enabled":true, - "responsive_web_enhance_cards_enabled":false - }''' - - name: queryId - in: query - required: true - schema: - type: string - default: "37RUvMgTiEVYYfrRTVDxpw" - example: "'37RUvMgTiEVYYfrRTVDxpw'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/TimelineResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "timeline" - - "login-required" - - "graphql" - - /VEwO8c1TYdm5zjxCOIiwFw/ListLatestTweetsTimeline: - get: - operationId: getListLatestTweetsTimeline - description: get tweet list of timeline - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: ''' - { - "listId":"000000000000", - "count":20, - "withDownvotePerspective":false - }''' - - name: features - in: query - required: true - schema: - type: string - example: ''' - { - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "tweetypie_unmention_optimization_enabled": true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled": false, - "freedom_of_speech_not_reach_fetch_enabled": false, - "standardized_nudges_misinfo": true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, - "interactive_text_enabled": true, - "responsive_web_text_conversations_enabled": false, - "longform_notetweets_rich_text_read_enabled": true, - "responsive_web_enhance_cards_enabled": false, - }''' - - name: queryId - in: query - required: true - schema: - type: string - default: "VEwO8c1TYdm5zjxCOIiwFw" - example: "'VEwO8c1TYdm5zjxCOIiwFw'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/ListTweetsTimelineResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "timeline" - - "login-required" - - "graphql" - - # user tweets - - /HuTx74BxAnezK1gWvYY7zg/UserTweets: - get: - operationId: getUserTweets - description: "get user tweets" - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: ''' - { - "userId": "44196397", - "count": 40, - "includePromotedContent": true, - "withQuickPromoteEligibilityTweetFields": true, - "withVoice": true, - "withV2Timeline": true - } - ''' - - name: features - in: query - required: true - schema: - type: string - example: ''' - { - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "tweetypie_unmention_optimization_enabled": true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled": false, - "freedom_of_speech_not_reach_fetch_enabled": false, - "standardized_nudges_misinfo": true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, - "interactive_text_enabled": true, - "responsive_web_text_conversations_enabled": false, - "longform_notetweets_rich_text_read_enabled": true, - "responsive_web_enhance_cards_enabled": false - } - ''' - - name: queryId - in: query - required: true - schema: - type: string - default: "HuTx74BxAnezK1gWvYY7zg" - example: "'HuTx74BxAnezK1gWvYY7zg'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/UserTweetsResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "user" - - "graphql" - - /RIWc55YCNyUJ-U3HHGYkdg/UserTweetsAndReplies: - get: - operationId: getUserTweetsAndReplies - description: "get user replies tweets" - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: ''' - { - "userId": "44196397", - "count": 20, - "includePromotedContent": false, - "withClientEventToken": false, - "withBirdwatchNotes": false, - "withVoice": true, - "withV2Timeline": true - } - ''' - - name: features - in: query - required: true - schema: - type: string - example: ''' - { - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "tweetypie_unmention_optimization_enabled": true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled": false, - "freedom_of_speech_not_reach_fetch_enabled": false, - "standardized_nudges_misinfo": true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, - "interactive_text_enabled": true, - "responsive_web_text_conversations_enabled": false, - "longform_notetweets_rich_text_read_enabled": true, - "responsive_web_enhance_cards_enabled": false - } - ''' - - name: queryId - in: query - required: true - schema: - type: string - default: "YqiE3JL1KNgf9nSljYdxaA" - example: "'YqiE3JL1KNgf9nSljYdxaA'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/UserTweetsResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "user" - - "graphql" - - /YqiE3JL1KNgf9nSljYdxaA/UserMedia: - get: - operationId: getUserMedia - description: "get user media tweets" - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: ''' - { - "userId": "44196397", - "count": 20, - "includePromotedContent": false, - "withClientEventToken": false, - "withBirdwatchNotes": false, - "withVoice": true, - "withV2Timeline": true - } - ''' - - name: features - in: query - required: true - schema: - type: string - example: ''' - { - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "tweetypie_unmention_optimization_enabled": true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled": false, - "freedom_of_speech_not_reach_fetch_enabled": false, - "standardized_nudges_misinfo": true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, - "interactive_text_enabled": true, - "responsive_web_text_conversations_enabled": false, - "longform_notetweets_rich_text_read_enabled": true, - "responsive_web_enhance_cards_enabled": false - } - ''' - - name: queryId - in: query - required: true - schema: - type: string - default: "YqiE3JL1KNgf9nSljYdxaA" - example: "'YqiE3JL1KNgf9nSljYdxaA'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/UserTweetsResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "user" - - "graphql" - - /5fmEkRT-1AdHqEsbVgehMg/Likes: - get: - operationId: getLikes - description: "get user likes tweets" - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: ''' - { - "userId": "44196397", - "count": 20, - "includePromotedContent": false, - "withClientEventToken": false, - "withBirdwatchNotes": false, - "withVoice": true, - "withV2Timeline": true - } - ''' - - name: features - in: query - required: true - schema: - type: string - example: ''' - { - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "tweetypie_unmention_optimization_enabled": true, - "vibe_api_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, - "tweet_awards_web_tipping_enabled": false, - "freedom_of_speech_not_reach_fetch_enabled": false, - "standardized_nudges_misinfo": true, - "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, - "interactive_text_enabled": true, - "responsive_web_text_conversations_enabled": false, - "longform_notetweets_rich_text_read_enabled": true, - "responsive_web_enhance_cards_enabled": false - } - ''' - - name: queryId - in: query - required: true - schema: - type: string - default: "YqiE3JL1KNgf9nSljYdxaA" - example: "'YqiE3JL1KNgf9nSljYdxaA'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/UserTweetsResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "user" - - "graphql" - - # user - - /sLVLhk0bGj3MVFEKTdax1w/UserByScreenName: - get: - operationId: getUserByScreenName - description: "get user by screen name" - parameters: - - name: variables - in: query - required: true - schema: - type: string - example: ''' - { - "screen_name": "elonmusk", - "withSafetyModeUserFields": true, - } - ''' - - name: features - in: query - required: true - schema: - type: string - example: ''' - { - "blue_business_profile_image_shape_enabled": true, - "responsive_web_graphql_exclude_directive_enabled": true, - "verified_phone_label_enabled": false, - "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, - "responsive_web_graphql_timeline_navigation_enabled": true, - } - ''' - - name: queryId - in: query - required: true - schema: - type: string - default: "VptSi88PiaQhBevFbGVlGg" - example: "'VptSi88PiaQhBevFbGVlGg'" - responses: - "200": - description: Successful operation - content: - application/json: - schema: - $ref: "#/components/schemas/UserResponse" - headers: - x-connection-hash: - $ref: "#/components/headers/x-connection-hash" - x-content-type-options: - $ref: "#/components/headers/x-content-type-options" - x-frame-options: - $ref: "#/components/headers/x-frame-options" - x-rate-limit-limit: - $ref: "#/components/headers/x-rate-limit-limit" - x-rate-limit-remaining: - $ref: "#/components/headers/x-rate-limit-remaining" - x-rate-limit-reset: - $ref: "#/components/headers/x-rate-limit-reset" - x-response-time: - $ref: "#/components/headers/x-response-time" - x-tfe-preserve-body: - $ref: "#/components/headers/x-tfe-preserve-body" - x-transaction-id: - $ref: "#/components/headers/x-transaction-id" - x-twitter-response-tags: - $ref: "#/components/headers/x-twitter-response-tags" - x-xss-protection: - $ref: "#/components/headers/x-xss-protection" - tags: - - "user" - - "graphql" - - # follow - - /FaBzCqZXuQCb4PhB0RHqHw/Following: - get: - operationId: getFollowers - description: get user list of followers - parameters: - - name: variables - in: query - required: true - schema: - type: string - - name: features - in: query - required: true - schema: - type: string - - name: queryId - in: query - schema: - type: string - default: "VptSi88PiaQhBevFbGVlGg" - responses: - "200": - description: Successful operation - tags: - - "follow" - - /VptSi88PiaQhBevFbGVlGg/Followers: - get: - operationId: getFollowing - description: get user list of following - parameters: - - name: variables - in: query - required: true - schema: - type: string - - name: features - in: query - required: true - schema: - type: string - - name: queryId - in: query - schema: - type: string - default: "FaBzCqZXuQCb4PhB0RHqHw" - responses: - "200": - description: Successful operation - tags: - - "follow" - - "graphql" - -components: - schemas: - # ================= General ================= - - TwitterTime: - type: string - pattern: "^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$" - example: "Sat Dec 31 23:59:59 +0000 2023" - - # ================= TypeName ================= - TypeName: - type: string - enum: - [ - TimelineTweet, - TimelineTimelineItem, - TimelineTimelineCursor, - TweetWithVisibilityResults, - TimelineTimelineModule, - Tweet, - User, - ] - - # ================= Timeline Response ================= - - TimelineResponse: - required: - - "data" - properties: - data: - $ref: "#/components/schemas/HomeTimelineResponseData" - - HomeTimelineResponseData: - required: - - "home" - properties: - home: - $ref: "#/components/schemas/HomeTimelineHome" - - HomeTimelineHome: - required: - - "home_timeline_urt" - properties: - home_timeline_urt: - $ref: "#/components/schemas/Timeline" - - ListTweetsTimelineResponse: - required: - - "data" - properties: - data: - $ref: "#/components/schemas/ListTweetsTimelineData" - - ListTweetsTimelineData: - required: - - "list" - properties: - home: - $ref: "#/components/schemas/ListTweetsTimelineList" - - ListTweetsTimelineList: - required: - - "tweets_timeline" - properties: - tweets_timeline: - $ref: "#/components/schemas/ListTweetsTimeline" - - ListTweetsTimeline: - required: - - "timeline" - properties: - timeline: - $ref: "#/components/schemas/Timeline" - - # ================= UserTweets Response ================= - - UserTweetsResponse: - required: - - "data" - properties: - data: - $ref: "#/components/schemas/UserTweetsData" - - UserTweetsData: - required: - - "user" - properties: - user: - $ref: "#/components/schemas/UserTweetsUser" - - UserTweetsUser: - required: - - "result" - properties: - result: - $ref: "#/components/schemas/UserTweetsResult" - - UserTweetsResult: - required: - - "__typename" - - "timeline_v2" - properties: - __typename: - $ref: "#/components/schemas/TypeName" # User - timeline_v2: - $ref: "#/components/schemas/TimelineV2" - - # ================= User Response ================= - - UserResponse: - required: - - "data" - properties: - data: - $ref: "#/components/schemas/UserResponseData" - - UserResponseData: - required: - - "user" - properties: - user: - $ref: "#/components/schemas/UserResults" - - # ================= Timeline ================= - - TimelineV2: - required: - - "timeline" - properties: - timeline: - $ref: "#/components/schemas/Timeline" - - Timeline: - required: - - "instructions" - properties: - instructions: - type: array - items: - $ref: "#/components/schemas/InstructionUnion" - metadata: - type: object # todo - responseObjects: - type: object # todo - - # ================= Content ================= - - InstructionUnion: - oneOf: - - $ref: "#/components/schemas/TimelineAddEntries" - - $ref: "#/components/schemas/TimelineClearCache" - - $ref: "#/components/schemas/TimelinePinEntry" - discriminator: - propertyName: type - mapping": # deprecated - TimelineAddEntries: "#/components/schemas/TimelineAddEntries" - TimelineClearCache: "#/components/schemas/TimelineClearCache" - TimelinePinEntry: "#/components/schemas/TimelinePinEntry" - - InstructionType: - type: string - enum: [TimelineAddEntries, TimelineClearCache, TimelinePinEntry] - - TimelineAddEntries: - required: - - type - - entries - properties: - type: - type: string - $ref: "#/components/schemas/InstructionType" # TimelineAddEntries - entries: - type: array - items: - $ref: "#/components/schemas/TimelineAddEntry" - - TimelineClearCache: - required: - - type - properties: - type: - type: string - $ref: "#/components/schemas/InstructionType" # TimelineClearCache - - TimelinePinEntry: - required: - - type - - entry - properties: - type: - type: string - $ref: "#/components/schemas/InstructionType" # TimelinePinEntry - entry: - $ref: "#/components/schemas/TimelineAddEntry" - - TimelineAddEntry: - required: - - "content" - - "entryId" - - "sortIndex" - properties: - content: - $ref: "#/components/schemas/ContentUnion" - entryId: - type: string - pattern: '^[a-z\-]+[0-9]+$' - sortIndex: - type: string - pattern: "[0-9]+$" - - # ================= Content ================= - ContentUnion: - oneOf: - - $ref: "#/components/schemas/TimelineTimelineItem" - - $ref: "#/components/schemas/TimelineTimelineCursor" - - $ref: "#/components/schemas/TimelineTimelineModule" - discriminator: - propertyName: entryType - mapping": # deprecated - TimelineTimelineItem: "#/components/schemas/TimelineTimelineItem" - TimelineTimelineCursor: "#/components/schemas/TimelineTimelineCursor" - TimelineTimelineModule: "#/components/schemas/TimelineTimelineModule" - - ContentEntryType: - type: string - enum: - [TimelineTimelineItem, TimelineTimelineCursor, TimelineTimelineModule] - - TimelineTimelineItem: - required: - - "__typename" - - "entryType" - - "itemContent" - properties: - __typename: - $ref: "#/components/schemas/TypeName" # TimelineTimelineItem - entryType: - type: string # enum - $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineItem - itemContent: - $ref: "#/components/schemas/ItemContent" - clientEventInfo: - type: object # todo - feedbackInfo: - type: object # todo - - TimelineTimelineCursor: - required: - - "__typename" - - "entryType" - - "cursorType" - - "value" - properties: - __typename: - $ref: "#/components/schemas/TypeName" # TimelineTimelineCursor - entryType: - type: string # enum - $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor - cursorType: - type: string - enum: [Top, Bottom] - value: - type: string - - TimelineTimelineModule: - required: - - "__typename" - - "entryType" - properties: - __typename: - $ref: "#/components/schemas/TypeName" # TimelineTimelineModule - - entryType: - type: string # enum - $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor - - # ================= ContentItem ================= - ContentItemType: - type: string - enum: [TimelineTweet] - - ItemContent: - required: - - "__typename" - - "itemType" - - "tweetDisplayType" - - "tweet_results" - properties: - __typename: - $ref: "#/components/schemas/TypeName" # TimelineTweet - itemType: - type: string # enum - $ref: "#/components/schemas/ContentItemType" # TimelineTweet - tweetDisplayType: - type: string - tweet_results: - $ref: "#/components/schemas/ItemResult" - socialContext: - type: object - properties: - contextType: - type: string # enum - text: - type: string - type: - type: string # enum - - ItemResult: - required: - - "result" - properties: - result: - $ref: "#/components/schemas/TweetUnion" - - # ================= Tweet ================= - - TweetUnion: - oneOf: - - $ref: "#/components/schemas/Tweet" - - $ref: "#/components/schemas/TweetWithVisibilityResults" - discriminator: - propertyName: __typename - mapping": # deprecated - Tweet: "#/components/schemas/Tweet" - TweetWithVisibilityResults: "#/components/schemas/TweetWithVisibilityResults" - - TweetWithVisibilityResults: - required: - - "__typename" - - "tweet" - properties: - __typename: - $ref: "#/components/schemas/TypeName" # TweetWithVisibilityResults - tweet: - $ref: "#/components/schemas/Tweet" - - Tweet: - required: - # - "__typename" - - "rest_id" - - "core" - - "edit_control" - - "edit_prespective" - - "is_translatable" - - "legacy" - - "views" - - properties: - __typename: - $ref: "#/components/schemas/TypeName" # Tweet - rest_id: - type: string - pattern: "^[0-9]+$" - core: - $ref: "#/components/schemas/UserResultCore" - unmention_data: - type: object # todo - edit_control: - type: object - properties: - edit_tweet_ids: - type: array - items: - type: string - pattern: "^[0-9]+$" - editable_until_msecs: - type: string - pattern: "^[0-9]+$" - is_edit_eligible: - type: boolean - edits_remaining: - type: string - pattern: "^[0-9]+$" - edit_prespective: - type: object - properties: - favorited: - type: boolean - retweeted: - type: boolean - is_translatable: - type: boolean - default: false - legacy: - $ref: "#/components/schemas/TweetLegacy" - views: - type: object - properties: - count: - type: string - pattern: "^[0-9]+$" - state: - type: string # enum - - TweetLegacy: - required: - - "bookmark_count" - - "bookmarked" - - "conversation_id_str" - - "created_at" - - "display_text_range" - - "entities" - - "favorite_count" - - "favorited" - - "full_text" - - "is_quote_status" - - "lang" - - "quote_count" - - "reply_count" - - "retweet_count" - - "retweeted" - - "user_id_str" - - "id_str" - properties: - bookmark_count: - type: integer - bookmarked: - type: boolean - created_at: - $ref: "#/components/schemas/TwitterTime" - conversation_id_str: - type: string - pattern: "^[0-9]+$" - display_text_range: - type: array - items: - type: integer - entities: - type: object - favorite_count: - type: integer - favorited: - type: boolean - full_text: - type: string - is_quote_status: - type: boolean - lang: - type: string # enum - possibly_sensitive: - type: boolean - default: false - possibly_sensitive_editable: - type: boolean - default: false - quote_count: - type: integer - reply_count: - type: integer - retweet_count: - type: integer - retweeted: - type: boolean - user_id_str: - type: string - pattern: "^[0-9]+$" - id_str: - type: string - pattern: "^[0-9]+$" - - # ================= User ================= - - UserResultCore: - required: - - "user_results" - properties: - user_results: - $ref: "#/components/schemas/UserResults" - - UserResults: - required: - - "result" - properties: - result: - $ref: "#/components/schemas/UserUnion" - - UserUnion: - oneOf: - - $ref: "#/components/schemas/User" - discriminator: - propertyName: __typename - mapping": # deprecated - User: "#/components/schemas/User" - - User: - required: - - "__typename" - - "affiliates_highlighted_label" - - "has_graduated_access" - - "id" - - "is_blue_verified" - - "legacy" - - "rest_id" - - "super_follow_eligible" - - "super_followed_by" - - "super_following" - - properties: - __typename: - $ref: "#/components/schemas/TypeName" # User - affiliates_highlighted_label: - type: object # todo - has_graduated_access: - type: boolean - has_nft_avatar: - type: boolean - default: false - id: - type: string - pattern: '^[a-z\-]+[0-9]+$' - is_blue_verified: - type: boolean - default: false - legacy: - $ref: "#/components/schemas/UserLegacy" - rest_id: - type: string - pattern: "^[0-9]+$" - business_account: - type: object # todo - super_follow_eligible: - type: boolean - default: false - super_followed_by: - type: boolean - default: false - super_following: - type: boolean - default: false - - UserLegacy: - required: - - "blocked_by" - - "blocking" - - "can_dm" - - "can_media_tag" - - "created_at" - - "default_profile" - - "default_profile_image" - - "description" - - "entities" - - "fast_followers_count" - - "favourites_count" - - "follow_request_sent" - - "followed_by" - - "followers_count" - - "following" - - "friends_count" - - "has_custom_timelines" - - "is_translator" - - "listed_count" - - "location" - - "media_count" - - "muting" - - "name" - - "normal_followers_count" - - "notifications" - - "pinned_tweet_ids_str" - - "possibly_sensitive" - - "profile_image_url_https" - - "profile_interstitial_type" - - "protected" - - "screen_name" - - "status" - - "statuses_count" - - "translator_type" - - "verified" - - "want_retweets" - properties: - blocked_by: - type: boolean - default: false - blocking: - type: boolean - default: false - can_dm: - type: boolean - default: false - can_media_tag: - type: boolean - default: false - created_at: - $ref: "#/components/schemas/TwitterTime" - default_profile: - type: boolean - default: false - default_profile_image: - type: boolean - default: false - description: - type: string - entities: - type: object # todo - fast_followers_count: - type: integer - favourites_count: - type: integer - default: 0 - follow_request_sent: - type: boolean - default: false - followed_by: - type: boolean - default: false - followers_count: - type: integer - default: 0 - following: - type: boolean - default: false - friends_count: - type: integer - default: 0 - has_custom_timelines: - type: boolean - default: false - is_translator: - type: boolean - default: false - listed_count: - type: integer - default: 0 - location: - type: string - media_count: - type: integer - default: 0 - muting: - type: boolean - default: false - name: - type: string - normal_followers_count: - type: integer - default: 0 - notifications: - type: boolean - default: false - pinned_tweet_ids_str: - type: array - items: - type: string - possibly_sensitive: - type: boolean - default: false - profile_banner_extensions: - type: object - profile_banner_url: - type: string - format: uri - profile_image_extensions: - type: object - profile_image_url_https: - type: string - format: uri - profile_interstitial_type: - type: string - protected: - type: boolean - default: false - screen_name: - type: string - statuses_count: - type: integer - default: 0 - translator_type: - type: string - url: - type: string - verified: - type: boolean - want_retweets: - type: boolean - default: false - headers: - x-connection-hash: - schema: - type: string - x-content-type-options: - schema: - type: string - x-frame-options: - schema: - type: string - x-rate-limit-limit: - schema: - type: integer - x-rate-limit-remaining: - schema: - type: integer - x-rate-limit-reset: - schema: - type: integer - x-response-time: - schema: - type: integer - x-tfe-preserve-body: - schema: - type: boolean - x-transaction-id: - schema: - type: string - x-twitter-response-tags: - schema: - type: string - x-xss-protection: - schema: - type: integer - - securitySchemes: - BearerAuth: - type: http - scheme: bearer - description: "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA" - - CsrfToken: - type: apiKey - in: header - name: x-csrf-token - - ActiveUser: - type: apiKey - in: header - name: x-twitter-active-user - description: "yes" - - AuthType: - type: apiKey - in: header - name: x-twitter-auth-type - description: "OAuth2Session" - - ClientLanguage: - type: apiKey - in: header - name: x-twitter-client-language - description: "en" - - CookieAuthToken: - type: apiKey - in: cookie - name: auth_token - - CookieCt0: - type: apiKey - in: cookie - name: ct0 - -tags: - - name: timeline - description: timeline - - name: tweet - description: tweet - - name: user - description: user - - name: follow - description: follow - - name: search - description: search - - name: dm - description: dm - - name: settings - description: settings - - name: notify - description: notify - - # === - - name: login required - description: login session required - - name: graphql - description: graphql - - name: login-flow - description: login flow - - name: report-flow - description: report flow - -security: - - bearerAuth: [] - - CsrfToken: [] - - ActiveUser: [] - - AuthType: [] - - ClientLanguage: [] - - CookieAuthToken: [] - - CookieCt0: [] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..f38077d533a85752076886f6113ed8ea3251af78 GIT binary patch literal 28 jcmezWFMy$vA(Fw7!I!~@!Ir_6!HhwV!GM96fr|kEY)l0o literal 0 HcmV?d00001 diff --git a/src/config/header.yaml b/src/config/header.yaml new file mode 100644 index 0000000..e7c2a23 --- /dev/null +++ b/src/config/header.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 +paths: {} + +components: + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer diff --git a/src/config/parameters.yaml b/src/config/parameters.yaml new file mode 100644 index 0000000..9f002a6 --- /dev/null +++ b/src/config/parameters.yaml @@ -0,0 +1,30 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 +paths: + /parameters: + get: + parameters: + - name: variables + in: query + required: true + schema: + type: string + example: "{{Variables}}" + - name: features + in: query + required: true + schema: + type: string + example: "{{Features}}" + - name: queryId + in: query + required: true + schema: + type: string + default: "{{Query}}" + example: "{{Query}}" + responses: + "200": + description: "" diff --git a/src/config/placeholder.json b/src/config/placeholder.json new file mode 100644 index 0000000..a55e75e --- /dev/null +++ b/src/config/placeholder.json @@ -0,0 +1,234 @@ +{ + "HomeTimeline": { + "Query": "HCosKfLNW1AcOo3la3mMgg", + "Variables": { + "count": 40, + "includePromotedContent": true, + "latestControlAvailable": true, + "withCommunity": true + }, + "Feature": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, + "HomeLatestTimeline": { + "Query": "zhX91JE87mWvfprhYE97xA", + "Variables": { + "count": 20, + "includePromotedContent": true, + "latestControlAvailable": true, + "requestContext": "launch" + }, + "Feature": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, + "ListLatestTweetsTimeline": { + "Query": "2TemLyqrMpTeAmysdbnVqw", + "Variables": { + "listId": "53044119", + "count": 20 + }, + "Feature": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, + "UserByScreenName": { + "Query": "sLVLhk0bGj3MVFEKTdax1w", + "Variables": { + "screen_name": "elonmusk", + "withSafetyModeUserFields": true + }, + "Features": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true + } + }, + "UserTweets": { + "Query": "HuTx74BxAnezK1gWvYY7zg", + "Variables": { + "userId": "44196397", + "count": 40, + "includePromotedContent": true, + "withQuickPromoteEligibilityTweetFields": true, + "withVoice": true, + "withV2Timeline": true + }, + "Features": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, + "UserTweetsAndReplies": { + "Query": "RIWc55YCNyUJ-U3HHGYkdg", + "Variables": { + "userId": "44196397", + "count": 40, + "includePromotedContent": true, + "withCommunity": true, + "withVoice": true, + "withV2Timeline": true + }, + "Features": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, + "UserMedia": { + "Query": "YqiE3JL1KNgf9nSljYdxaA", + "Variables": { + "userId": "44196397", + "count": 20, + "includePromotedContent": false, + "withClientEventToken": false, + "withBirdwatchNotes": false, + "withVoice": true, + "withV2Timeline": true + }, + "Features": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, + "Likes": { + "Query": "5fmEkRT-1AdHqEsbVgehMg", + "Variables": { + "userId": "44196397", + "count": 20, + "includePromotedContent": false, + "withClientEventToken": false, + "withBirdwatchNotes": false, + "withVoice": true, + "withV2Timeline": true + }, + "Features": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_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, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + } +} \ No newline at end of file diff --git a/src/openapi/openapi-3.0.yaml b/src/openapi/openapi-3.0.yaml new file mode 100644 index 0000000..db2f12b --- /dev/null +++ b/src/openapi/openapi-3.0.yaml @@ -0,0 +1,94 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + description: |- + Twitter OpenAPI(Swagger) specification + termsOfService: https://github.com/fa0311 + contact: + email: yuki@yuki0311.com + license: + name: GNU Affero General Public License v3. + url: https://raw.githubusercontent.com/fa0311/twitter-openapi/main/LICENSE.txt + version: 0.0.1 +servers: + - url: https://twitter.com/i/api/graphql + +paths: {} +components: + schemas: {} + + securitySchemes: + BearerAuth: + type: http + scheme: bearer + description: "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA" + + CsrfToken: + type: apiKey + in: header + name: x-csrf-token + + ActiveUser: + type: apiKey + in: header + name: x-twitter-active-user + description: "yes" + + AuthType: + type: apiKey + in: header + name: x-twitter-auth-type + description: "OAuth2Session" + + ClientLanguage: + type: apiKey + in: header + name: x-twitter-client-language + description: "en" + + CookieAuthToken: + type: apiKey + in: cookie + name: auth_token + + CookieCt0: + type: apiKey + in: cookie + name: ct0 + +tags: + - name: timeline + description: timeline + - name: tweet + description: tweet + - name: user + description: user + - name: follow + description: follow + - name: search + description: search + - name: dm + description: dm + - name: settings + description: settings + - name: notify + description: notify + + # === + - name: login required + description: login session required + - name: graphql + description: graphql + - name: login-flow + description: login flow + - name: report-flow + description: report flow + +security: + - bearerAuth: [] + - CsrfToken: [] + - ActiveUser: [] + - AuthType: [] + - ClientLanguage: [] + - CookieAuthToken: [] + - CookieCt0: [] diff --git a/src/openapi/path/follow.yaml b/src/openapi/path/follow.yaml new file mode 100644 index 0000000..160fd35 --- /dev/null +++ b/src/openapi/path/follow.yaml @@ -0,0 +1,27 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: + /{{FollowingQuery}}/Following: + get: + operationId: getFollowers + description: get user list of followers + responses: + "200": + description: Successful operation + tags: + - "follow" + - "graphql" + + /{{FollowersQuery}}/Followers: + get: + operationId: getFollowing + description: get user list of following + responses: + "200": + description: Successful operation + tags: + - "follow" + - "graphql" diff --git a/src/openapi/path/timeline.yaml b/src/openapi/path/timeline.yaml new file mode 100644 index 0000000..ee0be1c --- /dev/null +++ b/src/openapi/path/timeline.yaml @@ -0,0 +1,104 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: + /{{HomeTimelineQuery}}/HomeTimeline: + get: + operationId: getHomeTimeline + description: get tweet list of timeline + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/TimelineResponse" + tags: + - "timeline" + - "login-required" + - "graphql" + + /{{HomeLatestTimelineQuery}}/HomeLatestTimeline: + get: + operationId: getHomeLatestTimeline + description: get tweet list of timeline + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/TimelineResponse" + tags: + - "timeline" + - "login-required" + - "graphql" + + /{{ListLatestTweetsTimelineQuery}}/ListLatestTweetsTimeline: + get: + operationId: getListLatestTweetsTimeline + description: get tweet list of timeline + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/ListTweetsTimelineResponse" + tags: + - "timeline" + - "login-required" + - "graphql" + +components: + schemas: + TimelineResponse: + required: + - "data" + properties: + data: + $ref: "#/components/schemas/HomeTimelineResponseData" + + HomeTimelineResponseData: + required: + - "home" + properties: + home: + $ref: "#/components/schemas/HomeTimelineHome" + + HomeTimelineHome: + required: + - "home_timeline_urt" + properties: + home_timeline_urt: + $ref: "./../schemas/timeline.yaml#/components/schemas/Timeline" + + ListTweetsTimelineResponse: + required: + - "data" + properties: + data: + $ref: "#/components/schemas/ListTweetsTimelineData" + + ListTweetsTimelineData: + required: + - "list" + properties: + home: + $ref: "#/components/schemas/ListTweetsTimelineList" + + ListTweetsTimelineList: + required: + - "tweets_timeline" + properties: + tweets_timeline: + $ref: "#/components/schemas/ListTweetsTimeline" + + ListTweetsTimeline: + required: + - "timeline" + properties: + timeline: + $ref: "./../schemas/timeline.yaml#/components/schemas/Timeline" diff --git a/src/openapi/path/user.yaml b/src/openapi/path/user.yaml new file mode 100644 index 0000000..6c85550 --- /dev/null +++ b/src/openapi/path/user.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: + /{{UserByScreenNameQuery}}/UserByScreenName: + get: + operationId: getUserByScreenName + description: "get user by screen name" + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/UserResponse" + tags: + - "user" + - "graphql" + +components: + schemas: + UserResponse: + required: + - "data" + properties: + data: + $ref: "#/components/schemas/UserResponseData" + + UserResponseData: + required: + - "user" + properties: + user: + $ref: "./../schemas/user.yaml#/components/schemas/UserResults" diff --git a/src/openapi/path/usertweets.yaml b/src/openapi/path/usertweets.yaml new file mode 100644 index 0000000..aae98e2 --- /dev/null +++ b/src/openapi/path/usertweets.yaml @@ -0,0 +1,98 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: + /{{UserTweetsQuery}}/UserTweets: + get: + operationId: getUserTweets + description: "get user tweets" + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/UserTweetsResponse" + tags: + - "user" + - "graphql" + + /{{UserTweetsAndRepliesQuery}}/UserTweetsAndReplies: + get: + operationId: getUserTweetsAndReplies + description: "get user replies tweets" + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/UserTweetsResponse" + tags: + - "user" + - "graphql" + + /{{UserMediaQuery}}/UserMedia: + get: + operationId: getUserMedia + description: "get user media tweets" + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/UserTweetsResponse" + tags: + - "user" + - "graphql" + + /{{LikesQuery}}/Likes: + get: + operationId: getLikes + description: "get user likes tweets" + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/UserTweetsResponse" + tags: + - "user" + - "graphql" + +components: + schemas: + UserTweetsResponse: + required: + - "data" + properties: + data: + $ref: "#/components/schemas/UserTweetsData" + + UserTweetsData: + required: + - "user" + properties: + user: + $ref: "#/components/schemas/UserTweetsUser" + + UserTweetsUser: + required: + - "result" + properties: + result: + $ref: "#/components/schemas/UserTweetsResult" + + UserTweetsResult: + required: + - "__typename" + - "timeline_v2" + properties: + __typename: + $ref: "./../schemas/typename.yaml#/components/schemas/TypeName" # User + timeline_v2: + $ref: "./../schemas/timeline.yaml#/components/schemas/TimelineV2" diff --git a/src/openapi/schemas/content.yaml b/src/openapi/schemas/content.yaml new file mode 100644 index 0000000..337e7ca --- /dev/null +++ b/src/openapi/schemas/content.yaml @@ -0,0 +1,110 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: {} +components: + schemas: + ContentUnion: + oneOf: + - $ref: "#/components/schemas/TimelineTimelineItem" + - $ref: "#/components/schemas/TimelineTimelineCursor" + - $ref: "#/components/schemas/TimelineTimelineModule" + discriminator: + propertyName: entryType + mapping": # deprecated + TimelineTimelineItem: "#/components/schemas/TimelineTimelineItem" + TimelineTimelineCursor: "#/components/schemas/TimelineTimelineCursor" + TimelineTimelineModule: "#/components/schemas/TimelineTimelineModule" + + ContentEntryType: + type: string + enum: + [TimelineTimelineItem, TimelineTimelineCursor, TimelineTimelineModule] + + TimelineTimelineItem: + required: + - "__typename" + - "entryType" + - "itemContent" + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineItem + entryType: + type: string # enum + $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineItem + itemContent: + $ref: "#/components/schemas/ItemContent" + clientEventInfo: + type: object # todo + feedbackInfo: + type: object # todo + + TimelineTimelineCursor: + required: + - "__typename" + - "entryType" + - "cursorType" + - "value" + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineCursor + entryType: + type: string # enum + $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor + cursorType: + type: string + enum: [Top, Bottom] + value: + type: string + + TimelineTimelineModule: + required: + - "__typename" + - "entryType" + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineModule + + entryType: + type: string # enum + $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor + + # ================= ContentItem ================= + ContentItemType: + type: string + enum: [TimelineTweet] + + ItemContent: + required: + - "__typename" + - "itemType" + - "tweetDisplayType" + - "tweet_results" + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTweet + itemType: + type: string # enum + $ref: "#/components/schemas/ContentItemType" # TimelineTweet + tweetDisplayType: + type: string + tweet_results: + $ref: "#/components/schemas/ItemResult" + socialContext: + type: object + properties: + contextType: + type: string # enum + text: + type: string + type: + type: string # enum + + ItemResult: + required: + - "result" + properties: + result: + $ref: "./tweet.yaml#/components/schemas/TweetUnion" diff --git a/src/openapi/schemas/general.yaml b/src/openapi/schemas/general.yaml new file mode 100644 index 0000000..fd60f6d --- /dev/null +++ b/src/openapi/schemas/general.yaml @@ -0,0 +1,12 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: {} +components: + schemas: + TwitterTimeFormat: + type: string + pattern: "^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[12][0-9]|3[01]) (0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]) ([+-][0-9]{4}) ([0-9]{4})$" + example: "Sat Dec 31 23:59:59 +0000 2023" diff --git a/src/openapi/schemas/instruction.yaml b/src/openapi/schemas/instruction.yaml new file mode 100644 index 0000000..9e29f6a --- /dev/null +++ b/src/openapi/schemas/instruction.yaml @@ -0,0 +1,70 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: {} +components: + schemas: + InstructionUnion: + oneOf: + - $ref: "#/components/schemas/TimelineAddEntries" + - $ref: "#/components/schemas/TimelineClearCache" + - $ref: "#/components/schemas/TimelinePinEntry" + discriminator: + propertyName: type + mapping": # deprecated + TimelineAddEntries: "#/components/schemas/TimelineAddEntries" + TimelineClearCache: "#/components/schemas/TimelineClearCache" + TimelinePinEntry: "#/components/schemas/TimelinePinEntry" + + InstructionType: + type: string + enum: [TimelineAddEntries, TimelineClearCache, TimelinePinEntry] + + TimelineAddEntries: + required: + - type + - entries + properties: + type: + type: string + $ref: "#/components/schemas/InstructionType" # TimelineAddEntries + entries: + type: array + items: + $ref: "#/components/schemas/TimelineAddEntry" + + TimelineClearCache: + required: + - type + properties: + type: + type: string + $ref: "#/components/schemas/InstructionType" # TimelineClearCache + + TimelinePinEntry: + required: + - type + - entry + properties: + type: + type: string + $ref: "#/components/schemas/InstructionType" # TimelinePinEntry + entry: + $ref: "#/components/schemas/TimelineAddEntry" + + TimelineAddEntry: + required: + - "content" + - "entryId" + - "sortIndex" + properties: + content: + $ref: "./content.yaml#/components/schemas/ContentUnion" + entryId: + type: string + pattern: '^[a-z\-]+[0-9]+$' + sortIndex: + type: string + pattern: "[0-9]+$" diff --git a/src/openapi/schemas/timeline.yaml b/src/openapi/schemas/timeline.yaml new file mode 100644 index 0000000..0ec75ba --- /dev/null +++ b/src/openapi/schemas/timeline.yaml @@ -0,0 +1,27 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: {} +components: + schemas: + TimelineV2: + required: + - "timeline" + properties: + timeline: + $ref: "#/components/schemas/Timeline" + + Timeline: + required: + - "instructions" + properties: + instructions: + type: array + items: + $ref: "./../schemas/instruction.yaml#/components/schemas/InstructionUnion" + metadata: + type: object # todo + responseObjects: + type: object # todo diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml new file mode 100644 index 0000000..1c66435 --- /dev/null +++ b/src/openapi/schemas/tweet.yaml @@ -0,0 +1,152 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: {} + +components: + schemas: + TweetUnion: + oneOf: + - $ref: "#/components/schemas/Tweet" + - $ref: "#/components/schemas/TweetWithVisibilityResults" + discriminator: + propertyName: __typename + mapping": # deprecated + Tweet: "#/components/schemas/Tweet" + TweetWithVisibilityResults: "#/components/schemas/TweetWithVisibilityResults" + + TweetWithVisibilityResults: + required: + - "__typename" + - "tweet" + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults + tweet: + $ref: "#/components/schemas/Tweet" + + Tweet: + required: + # - "__typename" + - "rest_id" + - "core" + - "edit_control" + - "edit_prespective" + - "is_translatable" + - "legacy" + - "views" + + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # Tweet + rest_id: + type: string + pattern: "^[0-9]+$" + core: + $ref: "./user.yaml#/components/schemas/UserResultCore" + unmention_data: + type: object # todo + edit_control: + type: object + properties: + edit_tweet_ids: + type: array + items: + type: string + pattern: "^[0-9]+$" + editable_until_msecs: + type: string + pattern: "^[0-9]+$" + is_edit_eligible: + type: boolean + edits_remaining: + type: string + pattern: "^[0-9]+$" + edit_prespective: + type: object + properties: + favorited: + type: boolean + retweeted: + type: boolean + is_translatable: + type: boolean + default: false + legacy: + $ref: "#/components/schemas/TweetLegacy" + views: + type: object + properties: + count: + type: string + pattern: "^[0-9]+$" + state: + type: string # enum + + TweetLegacy: + required: + - "bookmark_count" + - "bookmarked" + - "conversation_id_str" + - "created_at" + - "display_text_range" + - "entities" + - "favorite_count" + - "favorited" + - "full_text" + - "is_quote_status" + - "lang" + - "quote_count" + - "reply_count" + - "retweet_count" + - "retweeted" + - "user_id_str" + - "id_str" + properties: + bookmark_count: + type: integer + bookmarked: + type: boolean + created_at: + $ref: "./general.yaml#/components/schemas/TwitterTimeFormat" + conversation_id_str: + type: string + pattern: "^[0-9]+$" + display_text_range: + type: array + items: + type: integer + entities: + type: object + favorite_count: + type: integer + favorited: + type: boolean + full_text: + type: string + is_quote_status: + type: boolean + lang: + type: string # enum + possibly_sensitive: + type: boolean + default: false + possibly_sensitive_editable: + type: boolean + default: false + quote_count: + type: integer + reply_count: + type: integer + retweet_count: + type: integer + retweeted: + type: boolean + user_id_str: + type: string + pattern: "^[0-9]+$" + id_str: + type: string + pattern: "^[0-9]+$" diff --git a/src/openapi/schemas/typename.yaml b/src/openapi/schemas/typename.yaml new file mode 100644 index 0000000..243b791 --- /dev/null +++ b/src/openapi/schemas/typename.yaml @@ -0,0 +1,19 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 +paths: {} +components: + schemas: + TypeName: + type: string + enum: + [ + TimelineTweet, + TimelineTimelineItem, + TimelineTimelineCursor, + TweetWithVisibilityResults, + TimelineTimelineModule, + Tweet, + User, + ] diff --git a/src/openapi/schemas/user.yaml b/src/openapi/schemas/user.yaml new file mode 100644 index 0000000..16baead --- /dev/null +++ b/src/openapi/schemas/user.yaml @@ -0,0 +1,219 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 +paths: {} +components: + schemas: + UserResultCore: + required: + - "user_results" + properties: + user_results: + $ref: "#/components/schemas/UserResults" + + UserResults: + required: + - "result" + properties: + result: + $ref: "#/components/schemas/UserUnion" + + UserUnion: + oneOf: + - $ref: "#/components/schemas/User" + discriminator: + propertyName: __typename + mapping": # deprecated + User: "#/components/schemas/User" + + User: + required: + - "__typename" + - "affiliates_highlighted_label" + - "has_graduated_access" + - "id" + - "is_blue_verified" + - "legacy" + - "rest_id" + - "super_follow_eligible" + - "super_followed_by" + - "super_following" + + properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # User + affiliates_highlighted_label: + type: object # todo + has_graduated_access: + type: boolean + has_nft_avatar: + type: boolean + default: false + id: + type: string + pattern: '^[a-z\-]+[0-9]+$' + is_blue_verified: + type: boolean + default: false + legacy: + $ref: "#/components/schemas/UserLegacy" + rest_id: + type: string + pattern: "^[0-9]+$" + business_account: + type: object # todo + super_follow_eligible: + type: boolean + default: false + super_followed_by: + type: boolean + default: false + super_following: + type: boolean + default: false + + UserLegacy: + required: + - "blocked_by" + - "blocking" + - "can_dm" + - "can_media_tag" + - "created_at" + - "default_profile" + - "default_profile_image" + - "description" + - "entities" + - "fast_followers_count" + - "favourites_count" + - "follow_request_sent" + - "followed_by" + - "followers_count" + - "following" + - "friends_count" + - "has_custom_timelines" + - "is_translator" + - "listed_count" + - "location" + - "media_count" + - "muting" + - "name" + - "normal_followers_count" + - "notifications" + - "pinned_tweet_ids_str" + - "possibly_sensitive" + - "profile_image_url_https" + - "profile_interstitial_type" + - "protected" + - "screen_name" + - "status" + - "statuses_count" + - "translator_type" + - "verified" + - "want_retweets" + properties: + blocked_by: + type: boolean + default: false + blocking: + type: boolean + default: false + can_dm: + type: boolean + default: false + can_media_tag: + type: boolean + default: false + created_at: + $ref: "./general.yaml#/components/schemas/TwitterTimeFormat" + default_profile: + type: boolean + default: false + default_profile_image: + type: boolean + default: false + description: + type: string + entities: + type: object # todo + fast_followers_count: + type: integer + favourites_count: + type: integer + default: 0 + follow_request_sent: + type: boolean + default: false + followed_by: + type: boolean + default: false + followers_count: + type: integer + default: 0 + following: + type: boolean + default: false + friends_count: + type: integer + default: 0 + has_custom_timelines: + type: boolean + default: false + is_translator: + type: boolean + default: false + listed_count: + type: integer + default: 0 + location: + type: string + media_count: + type: integer + default: 0 + muting: + type: boolean + default: false + name: + type: string + normal_followers_count: + type: integer + default: 0 + notifications: + type: boolean + default: false + pinned_tweet_ids_str: + type: array + items: + type: string + possibly_sensitive: + type: boolean + default: false + profile_banner_extensions: + type: object + profile_banner_url: + type: string + format: uri + profile_image_extensions: + type: object + profile_image_url_https: + type: string + format: uri + profile_interstitial_type: + type: string + protected: + type: boolean + default: false + screen_name: + type: string + statuses_count: + type: integer + default: 0 + translator_type: + type: string + url: + type: string + verified: + type: boolean + want_retweets: + type: boolean + default: false diff --git a/tools/build.py b/tools/build.py new file mode 100644 index 0000000..1eaf812 --- /dev/null +++ b/tools/build.py @@ -0,0 +1,92 @@ +import os +import glob +import json +import yaml +import shutil + + +class placeholder_manager: + data: dict + config: str = "src/config/placeholder.json" + + def __init__(self): + with open(self.config, mode="r", encoding="utf-8") as f: + self.data = json.load(f) + + def __replace(self, file, old: str, new) -> str: + if type(new) is dict: + dump = f"'{json.dumps(new)}'" + return file.replace(f'"{old}"', dump) + else: + return file.replace(f"{old}", new) + + def replace(self, file: str) -> str: + for prefix in self.data.keys(): + for key in self.data[prefix]: + value = self.data[prefix][key] + file = self.__replace(file, f"{{{{{prefix}{key}}}}}", value) + return file + + def replace_file(self, file: str, prefix: str) -> str: + if self.data.get(prefix, None) is None: + return file + for key in self.data[prefix].keys(): + value = self.data[prefix][key] + file = self.__replace(file, f"{{{{{key}}}}}", value) + return file + + +OUTPUT_DIR = "dist" +INPUT_DIR = "src/openapi" + + +def read(file: str): + with open(file, mode="r", encoding="utf-8") as f: + return f.read() + + +def write(file: str, data: str) -> None: + with open(file.replace(INPUT_DIR, OUTPUT_DIR, 1), mode="w+", encoding="utf-8") as f: + f.write(data) + + +def get_yaml(data, key): + return yaml.safe_load(placeholder.replace_file(str(data), key)) + + +shutil.rmtree("dist") +for dir in glob.glob(os.path.join(INPUT_DIR, "**/")): + os.makedirs(dir.replace(INPUT_DIR, OUTPUT_DIR, 1), exist_ok=True) + +placeholder = placeholder_manager() +parameters = read("src/config/parameters.yaml") +header = read("src/config/header.yaml") + +paths = {} +for file in glob.glob(os.path.join(INPUT_DIR, "**/*.yaml")): + file = file.replace(os.path.sep, "/") + relative = file.replace(INPUT_DIR, "", 1) + + load = yaml.safe_load(placeholder.replace(read(file))) + + for key in load["paths"].keys(): + append = get_yaml(parameters, key.split("/")[-1]) + req = load["paths"][key]["get"] + req["parameters"] = append["paths"]["/parameters"]["get"]["parameters"] + + append = get_yaml(header, key.split("/")[-1]) + req = load["paths"][key]["get"] + req["responses"]["200"]["headers"] = append["components"]["headers"] + + escape = key.replace("/", "~1") + paths.update({key: {"$ref": f".{relative}#/paths/{escape}"}}) + write(file, yaml.dump(load)) + + +file = "src/openapi/openapi-3.0.yaml" +data = read(file) +for path in paths: + load = yaml.safe_load(placeholder.replace(data)) + load["paths"] = paths + +write(file, yaml.dump(load))