1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 23:50:26 +01:00

Merge pull request #40 from fa0311/dev

Dev
This commit is contained in:
ふぁ 2023-09-20 10:55:14 +09:00 committed by GitHub
commit 2321ca5802
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 597 additions and 269 deletions

View file

@ -1877,6 +1877,21 @@ components:
required:
- viewCount
securitySchemes:
Accept:
description: '*/*'
in: header
name: Accept
type: apiKey
AcceptEncoding:
description: gzip, deflate, br
in: header
name: Accept-Encoding
type: apiKey
AcceptLanguage:
description: en-US,en;q=0.9
in: header
name: Accept-Language
type: apiKey
ActiveUser:
description: 'yes'
in: header
@ -1891,6 +1906,11 @@ components:
description: AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
scheme: bearer
type: http
CacheControl:
description: no-cache
in: header
name: Cache-Control
type: apiKey
ClientLanguage:
description: en
in: header
@ -1916,6 +1936,41 @@ components:
in: header
name: x-guest-token
type: apiKey
Pragma:
description: no-cache
in: header
name: Pragma
type: apiKey
SecChUa:
description: '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"'
in: header
name: Sec-Ch-Ua
type: apiKey
SecChUaMobile:
description: ?0
in: header
name: Sec-Ch-Ua-Mobile
type: apiKey
SecChUaPlatform:
description: '"Windows"'
in: header
name: Sec-Ch-Ua-Platform
type: apiKey
SecFetchDest:
description: empty
in: header
name: Sec-Fetch-Dest
type: apiKey
SecFetchMode:
description: cors
in: header
name: Sec-Fetch-Mode
type: apiKey
SecFetchSite:
description: same-origin
in: header
name: Sec-Fetch-Site
type: apiKey
UserAgent:
description: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/112.0.0.0 Safari/537.36
@ -2988,6 +3043,18 @@ paths:
properties:
media_entities:
items:
properties:
media_id:
default: '1111111111111111111'
example: '1111111111111111111'
type: string
tagged_users:
items:
type: object
type: array
required:
- media_id
- tagged_users
type: object
type: array
possibly_sensitive:
@ -5025,6 +5092,17 @@ security:
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: []
- AcceptEncoding: []
- AcceptLanguage: []
- CacheControl: []
- Pragma: []
- SecChUa: []
- SecChUaMobile: []
- SecChUaPlatform: []
- SecFetchDest: []
- SecFetchMode: []
- SecFetchSite: []
servers:
- url: https://twitter.com/i/api
tags:

View file

@ -1877,6 +1877,21 @@ components:
required:
- viewCount
securitySchemes:
Accept:
description: '*/*'
in: header
name: Accept
type: apiKey
AcceptEncoding:
description: gzip, deflate, br
in: header
name: Accept-Encoding
type: apiKey
AcceptLanguage:
description: en-US,en;q=0.9
in: header
name: Accept-Language
type: apiKey
ActiveUser:
description: 'yes'
in: header
@ -1891,6 +1906,11 @@ components:
description: AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
scheme: bearer
type: http
CacheControl:
description: no-cache
in: header
name: Cache-Control
type: apiKey
ClientLanguage:
description: en
in: header
@ -1916,6 +1936,41 @@ components:
in: header
name: x-guest-token
type: apiKey
Pragma:
description: no-cache
in: header
name: Pragma
type: apiKey
SecChUa:
description: '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"'
in: header
name: Sec-Ch-Ua
type: apiKey
SecChUaMobile:
description: ?0
in: header
name: Sec-Ch-Ua-Mobile
type: apiKey
SecChUaPlatform:
description: '"Windows"'
in: header
name: Sec-Ch-Ua-Platform
type: apiKey
SecFetchDest:
description: empty
in: header
name: Sec-Fetch-Dest
type: apiKey
SecFetchMode:
description: cors
in: header
name: Sec-Fetch-Mode
type: apiKey
SecFetchSite:
description: same-origin
in: header
name: Sec-Fetch-Site
type: apiKey
UserAgent:
description: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/112.0.0.0 Safari/537.36
@ -2888,17 +2943,16 @@ paths:
default: ojPdsZsimiJrUGLR1sjUtA
example: ojPdsZsimiJrUGLR1sjUtA
type: string
- in: query
name: queryId
required: true
requestBody:
content:
application/json:
schema:
properties:
queryId:
default: ojPdsZsimiJrUGLR1sjUtA
example: ojPdsZsimiJrUGLR1sjUtA
type: string
- in: query
name: variables
required: true
schema:
variables:
properties:
dark_request:
default: false
@ -2912,6 +2966,11 @@ paths:
- tweet_id
- dark_request
type: object
required:
- queryId
- variables
description: body
required: true
responses:
'200':
content:
@ -2960,54 +3019,12 @@ paths:
default: 1RyAhNwby-gzGCRVsMxKbQ
example: 1RyAhNwby-gzGCRVsMxKbQ
type: string
- in: query
name: queryId
required: true
schema:
default: 1RyAhNwby-gzGCRVsMxKbQ
example: 1RyAhNwby-gzGCRVsMxKbQ
type: string
- in: query
name: variables
required: true
requestBody:
content:
application/json:
schema:
properties:
dark_request:
default: false
example: false
type: boolean
media:
properties:
media_entities:
items:
type: object
type: array
possibly_sensitive:
default: false
example: false
type: boolean
required:
- media_entities
- possibly_sensitive
type: object
semantic_annotation_ids:
items:
type: object
type: array
tweet_text:
default: test
example: test
type: string
required:
- tweet_text
- media
- semantic_annotation_ids
- dark_request
type: object
- in: query
name: features
required: true
schema:
features:
properties:
blue_business_profile_image_shape_enabled:
default: true
@ -3106,6 +3123,62 @@ paths:
- responsive_web_graphql_timeline_navigation_enabled
- responsive_web_enhance_cards_enabled
type: object
queryId:
default: 1RyAhNwby-gzGCRVsMxKbQ
example: 1RyAhNwby-gzGCRVsMxKbQ
type: string
variables:
properties:
dark_request:
default: false
example: false
type: boolean
media:
properties:
media_entities:
items:
properties:
media_id:
default: '1111111111111111111'
example: '1111111111111111111'
type: string
tagged_users:
items:
type: object
type: array
required:
- media_id
- tagged_users
type: object
type: array
possibly_sensitive:
default: false
example: false
type: boolean
required:
- media_entities
- possibly_sensitive
type: object
semantic_annotation_ids:
items:
type: object
type: array
tweet_text:
default: test
example: test
type: string
required:
- tweet_text
- media
- semantic_annotation_ids
- dark_request
type: object
required:
- queryId
- variables
- features
description: body
required: true
responses:
'200':
content:
@ -3154,17 +3227,16 @@ paths:
default: iQtK4dl5hBmXewYZuEOKVw
example: iQtK4dl5hBmXewYZuEOKVw
type: string
- in: query
name: queryId
required: true
requestBody:
content:
application/json:
schema:
properties:
queryId:
default: iQtK4dl5hBmXewYZuEOKVw
example: iQtK4dl5hBmXewYZuEOKVw
type: string
- in: query
name: variables
required: true
schema:
variables:
properties:
dark_request:
default: false
@ -3178,6 +3250,11 @@ paths:
- source_tweet_id
- dark_request
type: object
required:
- queryId
- variables
description: body
required: true
responses:
'200':
content:
@ -3226,17 +3303,16 @@ paths:
default: VaenaVgh5q5ih7kvyVjgtg
example: VaenaVgh5q5ih7kvyVjgtg
type: string
- in: query
name: queryId
required: true
requestBody:
content:
application/json:
schema:
properties:
queryId:
default: VaenaVgh5q5ih7kvyVjgtg
example: VaenaVgh5q5ih7kvyVjgtg
type: string
- in: query
name: variables
required: true
schema:
variables:
properties:
dark_request:
default: false
@ -3250,6 +3326,11 @@ paths:
- tweet_id
- dark_request
type: object
required:
- queryId
- variables
description: body
required: true
responses:
'200':
content:
@ -3298,17 +3379,16 @@ paths:
default: lI07N6Otwv1PhnEgXILM7A
example: lI07N6Otwv1PhnEgXILM7A
type: string
- in: query
name: queryId
required: true
requestBody:
content:
application/json:
schema:
properties:
queryId:
default: lI07N6Otwv1PhnEgXILM7A
example: lI07N6Otwv1PhnEgXILM7A
type: string
- in: query
name: variables
required: true
schema:
variables:
properties:
dark_request:
default: false
@ -3322,6 +3402,11 @@ paths:
- tweet_id
- dark_request
type: object
required:
- queryId
- variables
description: body
required: true
responses:
'200':
content:
@ -5661,17 +5746,16 @@ paths:
default: ZYKSe-w7KEslx3JhSIk5LA
example: ZYKSe-w7KEslx3JhSIk5LA
type: string
- in: query
name: queryId
required: true
requestBody:
content:
application/json:
schema:
properties:
queryId:
default: ZYKSe-w7KEslx3JhSIk5LA
example: ZYKSe-w7KEslx3JhSIk5LA
type: string
- in: query
name: variables
required: true
schema:
variables:
properties:
dark_request:
default: false
@ -5685,6 +5769,11 @@ paths:
- tweet_id
- dark_request
type: object
required:
- queryId
- variables
description: body
required: true
responses:
'200':
content:
@ -6833,6 +6922,17 @@ security:
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: []
- AcceptEncoding: []
- AcceptLanguage: []
- CacheControl: []
- Pragma: []
- SecChUa: []
- SecChUaMobile: []
- SecChUaPlatform: []
- SecFetchDest: []
- SecFetchMode: []
- SecFetchSite: []
servers:
- url: https://twitter.com/i/api
tags:

View file

@ -34,6 +34,86 @@ paths:
type: string
default: "en"
description: "language code."
# Browser Schemes
- name: Accept
in: header
required: true
schema:
type: string
default: "*/*"
description: "*/*"
- name: Accept-Encoding
in: header
required: true
schema:
type: string
default: "gzip, deflate, br"
description: "gzip, deflate, br"
- name: Accept-Language
in: header
required: true
schema:
type: string
default: "en-US,en;q=0.9"
description: "en-US,en;q=0.9"
- name: Cache-Control
in: header
required: true
schema:
type: string
default: "no-cache"
description: "no-cache"
- name: Pragma
in: header
required: true
schema:
type: string
default: "no-cache"
description: "no-cache"
- name: Sec-Ch-Ua
in: header
required: true
schema:
type: string
default: '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"'
description: '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"'
- name: Sec-Ch-Ua-Mobile
in: header
required: true
schema:
type: string
default: "?0"
description: "?0"
- name: Sec-Ch-Ua-Platform
in: header
required: true
schema:
type: string
default: '"Windows"'
description: '"Windows"'
- name: Sec-Fetch-Dest
in: header
required: true
schema:
type: string
default: "empty"
description: "empty"
- name: Sec-Fetch-Mode
in: header
required: true
schema:
type: string
default: "cors"
description: "cors"
- name: Sec-Fetch-Site
in: header
required: true
schema:
type: string
default: "same-origin"
description: "same-origin"
responses:
"200":
description: ""
@ -60,8 +140,76 @@ components:
name: x-twitter-client-language
type: apiKey
# Browser Schemes
Accept:
description: "*/*"
in: header
name: Accept
type: apiKey
AcceptEncoding:
description: "gzip, deflate, br"
in: header
name: Accept-Encoding
type: apiKey
AcceptLanguage:
description: "en-US,en;q=0.9"
in: header
name: Accept-Language
type: apiKey
CacheControl:
description: "no-cache"
in: header
name: Cache-Control
type: apiKey
Pragma:
description: "no-cache"
in: header
name: Pragma
type: apiKey
SecChUa:
description: '"Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"'
in: header
name: Sec-Ch-Ua
type: apiKey
SecChUaMobile:
description: "?0"
in: header
name: Sec-Ch-Ua-Mobile
type: apiKey
SecChUaPlatform:
description: '"Windows"'
in: header
name: Sec-Ch-Ua-Platform
type: apiKey
SecFetchDest:
description: "empty"
in: header
name: Sec-Fetch-Dest
type: apiKey
SecFetchMode:
description: "cors"
in: header
name: Sec-Fetch-Mode
type: apiKey
SecFetchSite:
description: "same-origin"
in: header
name: Sec-Fetch-Site
type: apiKey
security:
- UserAgent: []
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: []
- AcceptEncoding: []
- AcceptLanguage: []
- CacheControl: []
- Pragma: []
- SecChUa: []
- SecChUaMobile: []
- SecChUaPlatform: []
- SecFetchDest: []
- SecFetchMode: []
- SecFetchSite: []

View file

@ -587,7 +587,12 @@
"variables": {
"tweet_text": "test",
"media": {
"media_entities": [],
"media_entities": [
{
"media_id": "1111111111111111111",
"tagged_users": []
}
],
"possibly_sensitive": false
},
"semantic_annotation_ids": [],

View file

@ -8,26 +8,19 @@ class Config:
def hooks_generator(self, queryParameterJson=True):
# https://stackoverflow.com/questions/34820064/defining-an-api-with-swagger-get-call-that-uses-json-in-parameters/45223964
if queryParameterJson:
# ["parameters"][0]["content"]["application/json"]["schema"]
getParamHook = AddParametersOnContent(
split=-1,
contentType="application/json",
ignoreKeys=["queryId"],
)
postParamHook = AddParametersOnParameters(
split=-1,
schemaType=None,
)
else:
# ["parameters"][0]["schema"]
getParamHook = AddParametersOnParameters(
split=-1,
schemaType="string",
ignoreKeys=["queryId"],
)
postParamHook = AddParametersOnBody(
split=-1,
schemaType=None,
contentType="application/json",
)
return {
"openapi": [AddSecuritySchemesOnSecuritySchemes()],
@ -45,7 +38,11 @@ class Config:
key: [
SetResponsesHeader(suffix=None),
AddPathQueryIdOnParameters(split=-1),
postParamHook,
AddParametersOnBody(
split=-1,
schemaType=None,
contentType="application/json",
),
]
for key in ["post"]
}