Skip to content

Commit

Permalink
Merge pull request #75 from fa0311/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
fa0311 authored Nov 1, 2024
2 parents a4947b3 + a5d954f commit 172a7ee
Show file tree
Hide file tree
Showing 13 changed files with 580 additions and 603 deletions.
60 changes: 60 additions & 0 deletions debug/requests_sample.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import json
from pathlib import Path

import requests

if Path("cookie.json").exists():
with open("cookie.json", "r") as f:
cookies = json.load(f)
cookies_dict = {k["name"]: k["value"] for k in cookies}


data = requests.get(
"https://twitter.com/i/api/graphql/BQ6xjFU6Mgm-WhEP3OiT9w/UserByScreenName",
cookies=cookies_dict,
headers={
"accept": "*/*",
"accept-encoding": "identity",
"accept-language": "en-US,en;q=0.9",
"authorization": "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA",
"content-type": "application/json",
"referer": "https://twitter.com",
"sec-ch-ua": '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/Chrome/130.0.0.0 Safari/537.36",
"x-csrf-token": cookies_dict["ct0"],
"x-twitter-active-user": "yes",
"x-twitter-auth-type": "OAuth2Session",
"x-twitter-client-language": "en",
},
params={
"variables": json.dumps(
{
"screen_name": "5unsetpowerln",
},
),
"features": json.dumps(
{
"hidden_profile_subscriptions_enabled": True,
"rweb_tipjar_consumption_enabled": True,
"responsive_web_graphql_exclude_directive_enabled": True,
"verified_phone_label_enabled": False,
"subscriptions_verification_info_is_identity_verified_enabled": True,
"subscriptions_verification_info_verified_since_enabled": True,
"highlights_tweets_tab_ui_enabled": True,
"responsive_web_twitter_article_notes_tab_enabled": True,
"subscriptions_feature_can_gift_premium": True,
"creator_subscriptions_tweet_preview_api_enabled": True,
"responsive_web_graphql_skip_user_profile_image_extensions_enabled": False,
"responsive_web_graphql_timeline_navigation_enabled": True,
}
),
"fieldToggles": json.dumps(
{
"withAuxiliaryUserLabels": False,
},
),
},
)
print(data.json())
161 changes: 80 additions & 81 deletions dist/compatible/openapi-3.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ components:
role:
enum:
- Member
- Moderator
type: string
user_results:
$ref: '#/components/schemas/UserResults'
Expand Down Expand Up @@ -400,7 +401,6 @@ components:
- id_str
- name
- description
- question
- search_tags
- actions
- admin_results
Expand Down Expand Up @@ -628,6 +628,7 @@ components:
- ShowMore
- ShowMoreThreads
- Gap
- ShowMoreThreadsPrompt
type: string
DeleteBookmarkResponse:
properties:
Expand Down Expand Up @@ -689,6 +690,8 @@ components:
properties:
actionText:
type: string
labelText:
type: string
required:
- actionText
type: object
Expand Down Expand Up @@ -3120,7 +3123,7 @@ components:
name: Accept
type: apiKey
AcceptEncoding:
description: gzip, deflate, br
description: gzip, deflate, br, zstd
in: header
name: Accept-Encoding
type: apiKey
Expand Down Expand Up @@ -3148,6 +3151,15 @@ components:
in: header
name: x-twitter-client-language
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:
description: HttpOnly cookie
in: cookie
Expand All @@ -3158,8 +3170,13 @@ components:
in: cookie
name: ct0
type: apiKey
CookieGt0:
description: document.cookie.split('; ').find(row => row.startsWith('gt0='));
in: cookie
name: gt0
type: apiKey
CsrfToken:
description: ''
description: document.cookie.split('; ').find(row => row.startsWith('ct0='));
in: header
name: x-csrf-token
type: apiKey
Expand All @@ -3168,11 +3185,6 @@ components:
in: header
name: x-guest-token
type: apiKey
Priority:
description: u=1, i
in: header
name: Priority
type: apiKey
Referer:
description: https://x.com/home
in: header
Expand Down Expand Up @@ -3209,8 +3221,8 @@ components:
name: Sec-Fetch-Site
type: apiKey
UserAgent:
description: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like
Gecko) Chrome/130.0.0.0 Safari/537.36
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
Expand Down Expand Up @@ -3354,27 +3366,24 @@ paths:
'200':
description: Successful operation
headers:
status:
schema:
type: string
x-access-level:
x-connection-hash:
schema:
type: string
x-client-event-enabled:
x-rate-limit-limit:
schema:
type: boolean
x-connection-hash:
type: integer
x-rate-limit-remaining:
schema:
type: string
x-content-type-options:
type: integer
x-rate-limit-reset:
schema:
type: string
type: integer
x-response-time:
schema:
type: integer
x-transaction:
x-tfe-preserve-body:
schema:
type: string
type: boolean
x-transaction-id:
schema:
type: string
Expand Down Expand Up @@ -3470,27 +3479,24 @@ paths:
'200':
description: Successful operation
headers:
status:
schema:
type: string
x-access-level:
x-connection-hash:
schema:
type: string
x-client-event-enabled:
x-rate-limit-limit:
schema:
type: boolean
x-connection-hash:
type: integer
x-rate-limit-remaining:
schema:
type: string
x-content-type-options:
type: integer
x-rate-limit-reset:
schema:
type: string
type: integer
x-response-time:
schema:
type: integer
x-transaction:
x-tfe-preserve-body:
schema:
type: string
type: boolean
x-transaction-id:
schema:
type: string
Expand Down Expand Up @@ -3586,27 +3592,24 @@ paths:
'200':
description: Successful operation
headers:
status:
schema:
type: string
x-access-level:
x-connection-hash:
schema:
type: string
x-client-event-enabled:
x-rate-limit-limit:
schema:
type: boolean
x-connection-hash:
type: integer
x-rate-limit-remaining:
schema:
type: string
x-content-type-options:
type: integer
x-rate-limit-reset:
schema:
type: string
type: integer
x-response-time:
schema:
type: integer
x-transaction:
x-tfe-preserve-body:
schema:
type: string
type: boolean
x-transaction-id:
schema:
type: string
Expand Down Expand Up @@ -3666,27 +3669,24 @@ paths:
'200':
description: Successful operation
headers:
status:
schema:
type: string
x-access-level:
x-connection-hash:
schema:
type: string
x-client-event-enabled:
x-rate-limit-limit:
schema:
type: boolean
x-connection-hash:
type: integer
x-rate-limit-remaining:
schema:
type: string
x-content-type-options:
type: integer
x-rate-limit-reset:
schema:
type: string
type: integer
x-response-time:
schema:
type: integer
x-transaction:
x-tfe-preserve-body:
schema:
type: string
type: boolean
x-transaction-id:
schema:
type: string
Expand Down Expand Up @@ -3963,27 +3963,24 @@ paths:
'200':
description: Successful operation
headers:
status:
schema:
type: string
x-access-level:
x-connection-hash:
schema:
type: string
x-client-event-enabled:
x-rate-limit-limit:
schema:
type: boolean
x-connection-hash:
type: integer
x-rate-limit-remaining:
schema:
type: string
x-content-type-options:
type: integer
x-rate-limit-reset:
schema:
type: string
type: integer
x-response-time:
schema:
type: integer
x-transaction:
x-tfe-preserve-body:
schema:
type: string
type: boolean
x-transaction-id:
schema:
type: string
Expand Down Expand Up @@ -6645,26 +6642,28 @@ paths:
tags:
- other
security:
- CsrfToken: []
- CookieCt0: []
- GuestToken: []
- CookieAuthToken: []
- AuthType: []
- UserAgent: []
- BearerAuth: []
- ActiveUser: []
- ClientLanguage: []
- Accept: []
- AcceptEncoding: []
- AcceptLanguage: []
- Referer: []
- SecChUa: []
- SecChUaMobile: []
- SecChUaPlatform: []
- SecFetchDest: []
- SecFetchMode: []
- SecFetchSite: []
- Referer: []
- Priority: []
- UserAgent: []
- BearerAuth: []
- ClientTransactionId: []
- ClientUuid: []
- CsrfToken: []
- GuestToken: []
- ActiveUser: []
- AuthType: []
- ClientLanguage: []
- CookieCt0: []
- CookieAuthToken: []
- CookieGt0: []
servers:
- url: https://x.com/i/api
- url: https://twitter.com/i/api
Expand Down
Loading

0 comments on commit 172a7ee

Please sign in to comment.