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

Merge pull request #58 from fa0311/dev

update guest schema
This commit is contained in:
ふぁ 2024-02-19 15:20:02 +09:00 committed by GitHub
commit 832751de4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 53 additions and 2 deletions

View file

@ -1660,6 +1660,7 @@ components:
enum:
- Top
- Bottom
- TopAndBottom
type: string
type:
$ref: '#/components/schemas/InstructionType'

View file

@ -1660,6 +1660,7 @@ components:
enum:
- Top
- Bottom
- TopAndBottom
type: string
type:
$ref: '#/components/schemas/InstructionType'

View file

@ -1660,6 +1660,7 @@ components:
enum:
- Top
- Bottom
- TopAndBottom
type: string
type:
$ref: '#/components/schemas/InstructionType'

View file

@ -150,7 +150,7 @@ components:
$ref: "#/components/schemas/InstructionType" # TimelineTerminateTimeline
direction:
type: string
enum: [Top, Bottom]
enum: [Top, Bottom, TopAndBottom]
TimelineAddEntry:
required:

View file

@ -927,7 +927,6 @@ components:
- "symbols"
- "user_mentions"
- "urls"
- "timestamps"
properties:
hashtags:
type: array

View file

@ -0,0 +1,49 @@
import json
from pathlib import Path
import openapi_client as pt
def get_kwargs(key, additional):
kwargs = {"path_query_id": placeholder[key]["queryId"]}
if placeholder[key].get("variables") is not None:
kwargs["variables"] = json.dumps(placeholder[key]["variables"] | additional)
if placeholder[key].get("features") is not None:
kwargs["features"] = json.dumps(placeholder[key]["features"])
if placeholder[key].get("fieldToggles") is not None:
kwargs["field_toggles"] = json.dumps(placeholder[key]["fieldToggles"])
return kwargs
if __name__ == "__main__":
if Path("cookie.json").exists():
with open("cookie.json", "r") as f:
cookies = json.load(f)
cookies_str = "; ".join([f"{k}={v}" for k, v in cookies.items()])
with open("src/config/placeholder.json", "r") as f:
placeholder = json.load(f)
api_conf = pt.Configuration(
api_key={
"ClientLanguage": "en",
"ActiveUser": "yes",
"GuestToken": cookies["gt"],
},
)
api_conf.access_token = "AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"
api_client = pt.ApiClient(configuration=api_conf, cookie=cookies_str)
api_client.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
pt.TweetApi(api_client).get_user_tweets_with_http_info(
**get_kwargs("UserTweets", {}),
)
pt.TweetApi(api_client).get_user_highlights_tweets_with_http_info(
**get_kwargs("UserHighlightsTweets", {}),
)
pt.DefaultApi(api_client).get_tweet_result_by_rest_id_with_http_info(
**get_kwargs("TweetResultByRestId", {}),
)
pt.UserApi(api_client).get_user_by_screen_name_with_http_info(
**get_kwargs("UserByScreenName", {})
)