1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-10 15:20:26 +01:00

update hook to simpleted

Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2024-11-01 16:15:36 +09:00
parent b0107e081d
commit 69e1fdb20c
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
9 changed files with 423 additions and 614 deletions

View file

@ -3123,7 +3123,7 @@ components:
name: Accept name: Accept
type: apiKey type: apiKey
AcceptEncoding: AcceptEncoding:
description: gzip, deflate, br description: gzip, deflate, br, zstd
in: header in: header
name: Accept-Encoding name: Accept-Encoding
type: apiKey type: apiKey
@ -3151,6 +3151,15 @@ components:
in: header in: header
name: x-twitter-client-language name: x-twitter-client-language
type: apiKey type: apiKey
ClientTransactionId:
in: header
name: x-client-transaction-id
type: apiKey
ClientUuid:
description: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
in: header
name: x-client-uuid
type: apiKey
CookieAuthToken: CookieAuthToken:
description: HttpOnly cookie description: HttpOnly cookie
in: cookie in: cookie
@ -3161,8 +3170,13 @@ components:
in: cookie in: cookie
name: ct0 name: ct0
type: apiKey type: apiKey
CookieGt0:
description: document.cookie.split('; ').find(row => row.startsWith('gt0='));
in: cookie
name: gt0
type: apiKey
CsrfToken: CsrfToken:
description: '' description: document.cookie.split('; ').find(row => row.startsWith('ct0='));
in: header in: header
name: x-csrf-token name: x-csrf-token
type: apiKey type: apiKey
@ -3171,11 +3185,6 @@ components:
in: header in: header
name: x-guest-token name: x-guest-token
type: apiKey type: apiKey
Priority:
description: u=1, i
in: header
name: Priority
type: apiKey
Referer: Referer:
description: https://x.com/home description: https://x.com/home
in: header in: header
@ -3212,8 +3221,8 @@ components:
name: Sec-Fetch-Site name: Sec-Fetch-Site
type: apiKey type: apiKey
UserAgent: UserAgent:
description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like description: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
Gecko) Chrome/130.0.0.0 Safari/537.36 like Gecko) Chrome/130.0.0.0 Safari/537.36
in: header in: header
name: user-agent name: user-agent
type: apiKey type: apiKey
@ -3357,27 +3366,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3473,27 +3479,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3589,27 +3592,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3669,27 +3669,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3966,27 +3963,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -6648,26 +6642,28 @@ paths:
tags: tags:
- other - other
security: security:
- CsrfToken: []
- CookieCt0: []
- GuestToken: []
- CookieAuthToken: []
- AuthType: []
- UserAgent: []
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: [] - Accept: []
- AcceptEncoding: [] - AcceptEncoding: []
- AcceptLanguage: [] - AcceptLanguage: []
- Referer: []
- SecChUa: [] - SecChUa: []
- SecChUaMobile: [] - SecChUaMobile: []
- SecChUaPlatform: [] - SecChUaPlatform: []
- SecFetchDest: [] - SecFetchDest: []
- SecFetchMode: [] - SecFetchMode: []
- SecFetchSite: [] - SecFetchSite: []
- Referer: [] - UserAgent: []
- Priority: [] - BearerAuth: []
- ClientTransactionId: []
- ClientUuid: []
- CsrfToken: []
- GuestToken: []
- ActiveUser: []
- AuthType: []
- ClientLanguage: []
- CookieCt0: []
- CookieAuthToken: []
- CookieGt0: []
servers: servers:
- url: https://x.com/i/api - url: https://x.com/i/api
- url: https://twitter.com/i/api - url: https://twitter.com/i/api

View file

@ -3123,7 +3123,7 @@ components:
name: Accept name: Accept
type: apiKey type: apiKey
AcceptEncoding: AcceptEncoding:
description: gzip, deflate, br description: gzip, deflate, br, zstd
in: header in: header
name: Accept-Encoding name: Accept-Encoding
type: apiKey type: apiKey
@ -3151,6 +3151,15 @@ components:
in: header in: header
name: x-twitter-client-language name: x-twitter-client-language
type: apiKey type: apiKey
ClientTransactionId:
in: header
name: x-client-transaction-id
type: apiKey
ClientUuid:
description: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
in: header
name: x-client-uuid
type: apiKey
CookieAuthToken: CookieAuthToken:
description: HttpOnly cookie description: HttpOnly cookie
in: cookie in: cookie
@ -3161,8 +3170,13 @@ components:
in: cookie in: cookie
name: ct0 name: ct0
type: apiKey type: apiKey
CookieGt0:
description: document.cookie.split('; ').find(row => row.startsWith('gt0='));
in: cookie
name: gt0
type: apiKey
CsrfToken: CsrfToken:
description: '' description: document.cookie.split('; ').find(row => row.startsWith('ct0='));
in: header in: header
name: x-csrf-token name: x-csrf-token
type: apiKey type: apiKey
@ -3171,11 +3185,6 @@ components:
in: header in: header
name: x-guest-token name: x-guest-token
type: apiKey type: apiKey
Priority:
description: u=1, i
in: header
name: Priority
type: apiKey
Referer: Referer:
description: https://x.com/home description: https://x.com/home
in: header in: header
@ -3212,8 +3221,8 @@ components:
name: Sec-Fetch-Site name: Sec-Fetch-Site
type: apiKey type: apiKey
UserAgent: UserAgent:
description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like description: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
Gecko) Chrome/130.0.0.0 Safari/537.36 like Gecko) Chrome/130.0.0.0 Safari/537.36
in: header in: header
name: user-agent name: user-agent
type: apiKey type: apiKey
@ -3357,27 +3366,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3473,27 +3479,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3589,27 +3592,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3669,27 +3669,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3966,27 +3963,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -6590,26 +6584,28 @@ paths:
tags: tags:
- other - other
security: security:
- CsrfToken: []
- CookieCt0: []
- GuestToken: []
- CookieAuthToken: []
- AuthType: []
- UserAgent: []
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: [] - Accept: []
- AcceptEncoding: [] - AcceptEncoding: []
- AcceptLanguage: [] - AcceptLanguage: []
- Referer: []
- SecChUa: [] - SecChUa: []
- SecChUaMobile: [] - SecChUaMobile: []
- SecChUaPlatform: [] - SecChUaPlatform: []
- SecFetchDest: [] - SecFetchDest: []
- SecFetchMode: [] - SecFetchMode: []
- SecFetchSite: [] - SecFetchSite: []
- Referer: [] - UserAgent: []
- Priority: [] - BearerAuth: []
- ClientTransactionId: []
- ClientUuid: []
- CsrfToken: []
- GuestToken: []
- ActiveUser: []
- AuthType: []
- ClientLanguage: []
- CookieCt0: []
- CookieAuthToken: []
- CookieGt0: []
servers: servers:
- url: https://x.com/i/api - url: https://x.com/i/api
- url: https://twitter.com/i/api - url: https://twitter.com/i/api

View file

@ -3123,7 +3123,7 @@ components:
name: Accept name: Accept
type: apiKey type: apiKey
AcceptEncoding: AcceptEncoding:
description: gzip, deflate, br description: gzip, deflate, br, zstd
in: header in: header
name: Accept-Encoding name: Accept-Encoding
type: apiKey type: apiKey
@ -3151,6 +3151,15 @@ components:
in: header in: header
name: x-twitter-client-language name: x-twitter-client-language
type: apiKey type: apiKey
ClientTransactionId:
in: header
name: x-client-transaction-id
type: apiKey
ClientUuid:
description: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
in: header
name: x-client-uuid
type: apiKey
CookieAuthToken: CookieAuthToken:
description: HttpOnly cookie description: HttpOnly cookie
in: cookie in: cookie
@ -3161,8 +3170,13 @@ components:
in: cookie in: cookie
name: ct0 name: ct0
type: apiKey type: apiKey
CookieGt0:
description: document.cookie.split('; ').find(row => row.startsWith('gt0='));
in: cookie
name: gt0
type: apiKey
CsrfToken: CsrfToken:
description: '' description: document.cookie.split('; ').find(row => row.startsWith('ct0='));
in: header in: header
name: x-csrf-token name: x-csrf-token
type: apiKey type: apiKey
@ -3171,11 +3185,6 @@ components:
in: header in: header
name: x-guest-token name: x-guest-token
type: apiKey type: apiKey
Priority:
description: u=1, i
in: header
name: Priority
type: apiKey
Referer: Referer:
description: https://x.com/home description: https://x.com/home
in: header in: header
@ -3212,8 +3221,8 @@ components:
name: Sec-Fetch-Site name: Sec-Fetch-Site
type: apiKey type: apiKey
UserAgent: UserAgent:
description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like description: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,
Gecko) Chrome/130.0.0.0 Safari/537.36 like Gecko) Chrome/130.0.0.0 Safari/537.36
in: header in: header
name: user-agent name: user-agent
type: apiKey type: apiKey
@ -3357,27 +3366,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3473,27 +3479,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3589,27 +3592,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3669,27 +3669,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -3966,27 +3963,24 @@ paths:
'200': '200':
description: Successful operation description: Successful operation
headers: headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash: x-connection-hash:
schema: schema:
type: string type: string
x-content-type-options: x-rate-limit-limit:
schema: schema:
type: string type: integer
x-rate-limit-remaining:
schema:
type: integer
x-rate-limit-reset:
schema:
type: integer
x-response-time: x-response-time:
schema: schema:
type: integer type: integer
x-transaction: x-tfe-preserve-body:
schema: schema:
type: string type: boolean
x-transaction-id: x-transaction-id:
schema: schema:
type: string type: string
@ -8796,26 +8790,28 @@ paths:
tags: tags:
- other - other
security: security:
- CsrfToken: []
- CookieCt0: []
- GuestToken: []
- CookieAuthToken: []
- AuthType: []
- UserAgent: []
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: [] - Accept: []
- AcceptEncoding: [] - AcceptEncoding: []
- AcceptLanguage: [] - AcceptLanguage: []
- Referer: []
- SecChUa: [] - SecChUa: []
- SecChUaMobile: [] - SecChUaMobile: []
- SecChUaPlatform: [] - SecChUaPlatform: []
- SecFetchDest: [] - SecFetchDest: []
- SecFetchMode: [] - SecFetchMode: []
- SecFetchSite: [] - SecFetchSite: []
- Referer: [] - UserAgent: []
- Priority: [] - BearerAuth: []
- ClientTransactionId: []
- ClientUuid: []
- CsrfToken: []
- GuestToken: []
- ActiveUser: []
- AuthType: []
- ClientLanguage: []
- CookieCt0: []
- CookieAuthToken: []
- CookieGt0: []
servers: servers:
- url: https://x.com/i/api - url: https://x.com/i/api
- url: https://twitter.com/i/api - url: https://twitter.com/i/api

View file

@ -1,35 +0,0 @@
openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths: {}
components:
headers:
status:
schema:
type: string
x-access-level:
schema:
type: string
x-client-event-enabled:
schema:
type: boolean
x-connection-hash:
schema:
type: string
x-content-type-options:
schema:
type: string
x-response-time:
schema:
type: integer
x-transaction:
schema:
type: string
x-transaction-id:
schema:
type: string
x-twitter-response-tags:
schema:
type: string

View file

@ -1,241 +0,0 @@
openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths:
/parameters:
get:
parameters:
- name: user-agent
in: header
required: true
schema:
type: string
default: "Not Implemented"
description: "UserAgent, some APIs may be rejected if changed."
- name: authorization
in: header
required: true
schema:
type: string
default: "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"
description: "It is a constant value and does not need to be changed."
- name: x-twitter-active-user
in: header
required: true
schema:
type: string
default: "yes"
description: "Unknown what this value means."
- name: x-twitter-client-language
in: header
required: true
schema:
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"
- name: Referer
in: header
required: true
schema:
type: string
default: "https://x.com/home"
description: "https://x.com/home"
- name: Priority
in: header
required: true
schema:
type: string
default: "u=1, i"
description: "u=1, i"
responses:
"200":
description: ""
components:
securitySchemes:
UserAgent:
description: "Not Implemented"
in: header
name: user-agent
type: apiKey
BearerAuth:
description: AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
scheme: bearer
type: http
ActiveUser:
description: "yes"
in: header
name: x-twitter-active-user
type: apiKey
ClientLanguage:
description: en
in: header
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
Referer:
description: "https://x.com/home"
in: header
name: Referer
type: apiKey
Priority:
description: "u=1, i"
in: header
name: Priority
type: apiKey
security:
- UserAgent: []
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: []
- AcceptEncoding: []
- AcceptLanguage: []
# - CacheControl: []
# - Pragma: []
- SecChUa: []
- SecChUaMobile: []
- SecChUaPlatform: []
- SecFetchDest: []
- SecFetchMode: []
- SecFetchSite: []
- Referer: []
- Priority: []

View file

@ -19,42 +19,144 @@ components:
schemas: {} schemas: {}
securitySchemes: securitySchemes:
Accept:
description: "*/*"
in: header
name: Accept
type: apiKey
AcceptEncoding:
description: "gzip, deflate, br, zstd"
in: header
name: Accept-Encoding
type: apiKey
AcceptLanguage:
description: "en-US,en;q=0.9"
in: header
name: Accept-Language
type: apiKey
Referer:
description: "https://x.com/home"
in: header
name: Referer
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/130.0.0.0 Safari/537.36"
in: header
name: user-agent
type: apiKey
BearerAuth:
description: AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
scheme: bearer
type: http
ClientTransactionId:
type: apiKey
in: header
name: x-client-transaction-id
ClientUuid:
type: apiKey
in: header
name: x-client-uuid
description: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
CsrfToken: CsrfToken:
type: apiKey type: apiKey
in: header in: header
name: x-csrf-token name: x-csrf-token
description: ""
CookieCt0:
type: apiKey
in: cookie
name: ct0
description: "document.cookie.split('; ').find(row => row.startsWith('ct0='));" description: "document.cookie.split('; ').find(row => row.startsWith('ct0='));"
GuestToken: GuestToken:
type: apiKey type: apiKey
in: header in: header
name: x-guest-token name: x-guest-token
description: "document.cookie.split('; ').find(row => row.startsWith('gt='));" description: "document.cookie.split('; ').find(row => row.startsWith('gt='));"
ActiveUser:
CookieAuthToken: description: "yes"
in: header
name: x-twitter-active-user
type: apiKey type: apiKey
in: cookie
name: auth_token
description: "HttpOnly cookie"
AuthType: AuthType:
type: apiKey type: apiKey
in: header in: header
name: x-twitter-auth-type name: x-twitter-auth-type
description: "OAuth2Session if you are logged in" description: "OAuth2Session if you are logged in"
ClientLanguage:
description: en
in: header
name: x-twitter-client-language
type: apiKey
CookieAuthToken:
type: apiKey
in: cookie
name: auth_token
description: "HttpOnly cookie"
CookieCt0:
type: apiKey
in: cookie
name: ct0
description: "document.cookie.split('; ').find(row => row.startsWith('ct0='));"
CookieGt0:
type: apiKey
in: cookie
name: gt0
description: "document.cookie.split('; ').find(row => row.startsWith('gt0='));"
security: security:
# Browser Schemes
- Accept: []
- AcceptEncoding: []
- AcceptLanguage: []
- Referer: []
- SecChUa: []
- SecChUaMobile: []
- SecChUaPlatform: []
- SecFetchDest: []
- SecFetchMode: []
- SecFetchSite: []
# Other Auth Schemes
- UserAgent: []
- BearerAuth: []
# X Schemes
- ClientTransactionId: []
- ClientUuid: []
- CsrfToken: [] - CsrfToken: []
- CookieCt0: []
- GuestToken: [] - GuestToken: []
- CookieAuthToken: [] # Twitter Schemes
- ActiveUser: []
- AuthType: [] - AuthType: []
- ClientLanguage: []
# Cookie Schemes
- CookieCt0: []
- CookieAuthToken: []
- CookieGt0: []
tags: tags:
- name: user - name: user
description: Responses containing User objects. description: Responses containing User objects.

View file

@ -162,9 +162,7 @@ def task_callback(file, thread=True):
def kebab_to_upper_camel(text: dict[str, Any]) -> dict[str, Any]: def kebab_to_upper_camel(text: dict[str, Any]) -> dict[str, Any]:
res = {} res = {}
for key, value in text.items(): for key, value in text.items():
new_key = "".join( new_key = "".join([x.capitalize() for x in remove_prefix(key).split("-")])
[x.capitalize() for x in key.replace("x-twitter-", "").split("-")]
)
res[new_key] = value res[new_key] = value
return res return res
@ -174,6 +172,14 @@ def get_header(data: dict, name: str):
return {key: value for key, value in data[name].items() if key not in ignore} return {key: value for key, value in data[name].items() if key not in ignore}
def remove_prefix(text: str) -> str:
if text.startswith("x-twitter-"):
return text[10:]
if text.startswith("x-"):
return text[2:]
return text
def error_dump(e): def error_dump(e):
if ERROR_UNCATCHED: if ERROR_UNCATCHED:
raise raise
@ -243,23 +249,19 @@ if __name__ == "__main__":
) )
latest_user_agent = json.loads(latest_user_agent_res.data.decode("utf-8")) latest_user_agent = json.loads(latest_user_agent_res.data.decode("utf-8"))
api_conf = pt.Configuration( api_conf = pt.Configuration(
api_key={ api_key=kebab_to_upper_camel(
**kebab_to_upper_camel( {
{ **get_header(latest_user_agent, "chrome-fetch"),
**get_header(latest_user_agent, "chrome-fetch"), "sec-ch-ua-platform": '"Windows"',
"sec-ch-ua-platform": '"Windows"', "accept-encoding": "identity",
"accept-encoding": "identity", "referer": twitter_url,
"pragma": "no-cache", "authorization": f"Bearer {access_token}",
"referer": twitter_url, "x-twitter-auth-type": "OAuth2Session",
"priority": "u=1, i", "x-twitter-client-language": "en",
"authorization": f"Bearer {access_token}", "x-twitter-active-user": "yes",
"x-twitter-auth-type": "OAuth2Session", "x-csrf-token": cookies["ct0"],
"x-twitter-client-language": "en", },
"x-twitter-active-user": "yes", ),
"x-twitter-csrf-token": cookies["ct0"],
},
),
},
) )
api_conf.access_token = access_token api_conf.access_token = access_token
api_client = pt.ApiClient(configuration=api_conf, cookie=cookies_str) api_client = pt.ApiClient(configuration=api_conf, cookie=cookies_str)

View file

@ -3,10 +3,8 @@ from hooks import (
AddParametersOnContent, AddParametersOnContent,
AddParametersOnParameters, AddParametersOnParameters,
AddPathQueryIdOnParameters, AddPathQueryIdOnParameters,
AddSecuritySchemesOnSecuritySchemes,
RemoveErrorHandle, RemoveErrorHandle,
SetResponsesHeader, SetResponsesHeader,
SetUserAgentOnSecuritySchemes,
) )
@ -41,15 +39,12 @@ class Config:
additionalHooks.append(RemoveErrorHandle()) additionalHooks.append(RemoveErrorHandle())
return { return {
"openapi": [ "openapi": [],
AddSecuritySchemesOnSecuritySchemes(),
SetUserAgentOnSecuritySchemes(),
],
"schemas": [], "schemas": [],
"other": [], "other": [],
"request": { "request": {
key: [ key: [
SetResponsesHeader(suffix=None), SetResponsesHeader(),
AddPathQueryIdOnParameters(split=-1), AddPathQueryIdOnParameters(split=-1),
getParamHook, getParamHook,
*additionalHooks, *additionalHooks,
@ -58,7 +53,7 @@ class Config:
} }
| { | {
key: [ key: [
SetResponsesHeader(suffix=None), SetResponsesHeader(),
AddPathQueryIdOnParameters(split=-1), AddPathQueryIdOnParameters(split=-1),
AddParametersOnBody( AddParametersOnBody(
split=-1, split=-1,
@ -71,14 +66,14 @@ class Config:
} }
| { | {
key: [ key: [
SetResponsesHeader(suffix="legacy"), SetResponsesHeader(),
AddParametersOnParameters(split=2, schemaType=None), AddParametersOnParameters(split=2, schemaType=None),
] ]
for key in ["v1.1-get", "v2.0-get"] for key in ["v1.1-get", "v2.0-get"]
} }
| { | {
key: [ key: [
SetResponsesHeader(suffix="legacy"), SetResponsesHeader(),
AddParametersOnBody( AddParametersOnBody(
split=2, split=2,
schemaType=None, schemaType=None,

View file

@ -1,6 +1,5 @@
import json import json
import urllib3
import yaml import yaml
@ -61,12 +60,12 @@ class HookBase:
with open("src/config/placeholder.json", mode="r", encoding="utf-8") as f: with open("src/config/placeholder.json", mode="r", encoding="utf-8") as f:
return yaml.safe_load(f) return yaml.safe_load(f)
def load_user_agent(self) -> str: # def load_user_agent(self) -> str:
user_agent = urllib3.PoolManager().request( # user_agent = urllib3.PoolManager().request(
"GET", # "GET",
"https://raw.githubusercontent.com/fa0311/latest-user-agent/main/output.json", # "https://raw.githubusercontent.com/fa0311/latest-user-agent/main/output.json",
) # )
return json.loads(user_agent.data)["chrome-fetch"] # return json.loads(user_agent.data)["chrome-fetch"]
# HookBase extends # HookBase extends
@ -104,22 +103,22 @@ class RequestHookBase(HookBase):
# OpenapiHookBase extends # OpenapiHookBase extends
class AddSecuritySchemesOnSecuritySchemes(OpenapiHookBase): # class AddSecuritySchemesOnSecuritySchemes(OpenapiHookBase):
def hook(self, value: dict): # def hook(self, value: dict):
value = super().hook(value) # value = super().hook(value)
component = self.load_component("security_schemes") # component = self.load_component("security_schemes")
param = component["components"]["securitySchemes"] # param = component["components"]["securitySchemes"]
value["components"]["securitySchemes"].update(param) # value["components"]["securitySchemes"].update(param)
value["security"].extend(component["security"]) # value["security"].extend(component["security"])
return value # return value
class SetUserAgentOnSecuritySchemes(OpenapiHookBase): # class SetUserAgentOnSecuritySchemes(OpenapiHookBase):
def hook(self, value: dict): # def hook(self, value: dict):
value = super().hook(value) # value = super().hook(value)
param = value["components"]["securitySchemes"] # param = value["components"]["securitySchemes"]
param["UserAgent"]["description"] = self.load_user_agent() # param["UserAgent"]["description"] = self.load_user_agent()
return value # return value
# SchemasHookBase extends # SchemasHookBase extends
@ -158,22 +157,22 @@ class RequiredCheck(SchemasHookBase):
# RequestHookBase extends # RequestHookBase extends
class AddSecuritySchemesOnHeader(RequestHookBase): # class AddSecuritySchemesOnHeader(RequestHookBase):
def hook(self, path: str, value: dict): # def hook(self, path: str, value: dict):
path, value = super().hook(path, value) # path, value = super().hook(path, value)
component = self.load_component("security_schemes") # component = self.load_component("security_schemes")
param = component["paths"]["/parameters"]["get"]["parameters"] # param = component["paths"]["/parameters"]["get"]["parameters"]
value["parameters"].extend(param) # value["parameters"].extend(param)
return path, value # return path, value
class SetUserAgentOnHeader(RequestHookBase): # class SetUserAgentOnHeader(RequestHookBase):
def hook(self, path: str, value: dict): # def hook(self, path: str, value: dict):
path, value = super().hook(path, value) # path, value = super().hook(path, value)
component = self.load_component("security_schemes") # component = self.load_component("security_schemes")
param = component["paths"]["/parameters"]["get"]["parameters"] # param = component["paths"]["/parameters"]["get"]["parameters"]
value["parameters"].extend(param) # value["parameters"].extend(param)
return path, value # return path, value
class ReplaceQueryIdPlaceholder(RequestHookBase): class ReplaceQueryIdPlaceholder(RequestHookBase):
@ -186,13 +185,12 @@ class ReplaceQueryIdPlaceholder(RequestHookBase):
class SetResponsesHeader(RequestHookBase): class SetResponsesHeader(RequestHookBase):
suffix: str suffix: str
def __init__(self, suffix: str | None = None): def __init__(self):
super().__init__() super().__init__()
self.suffix = "" if suffix is None else "_" + suffix
def hook(self, path: str, value: dict): def hook(self, path: str, value: dict):
path, value = super().hook(path, value) path, value = super().hook(path, value)
component = self.load_component("response_header" + self.suffix) component = self.load_component("response_header")
value["responses"]["200"]["headers"] = component["components"]["headers"] value["responses"]["200"]["headers"] = component["components"]["headers"]
return path, value return path, value