forked from zedeus/nitter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6313623
commit b9d38a3
Showing
11 changed files
with
345 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
NITTER_GUEST_ACCOUNTS_URL=https://guest-keeper.fly.dev/guest-accounts | ||
NITTER_GUEST_ACCOUNTS=[{"oauth_token": "1761830062448357376-fxw4T42gsmuP6DwMHPyX5y0rB4gjCH", "oauth_token_secret": "1M2q8ynnadZKrZjaAb8eeNXnbGRVawwoSGIaYOSrquFmk"},{"oauth_token": "1761829912413872128-9hslQeedW43tG8x5GInmtDogEFpVmF", "oauth_token_secret": "x7tTPr3CsrOoNox9we1LuNmgZAoDrFs1vuRvy9HiIFmJ7"},{"oauth_token": "1761830326618173440-VbeMAkNQAHgw8HI3or1r4dw0DaFZNq", "oauth_token_secret": "IUne5k56CeLrizMTggpqO7cclt922d4SRifQIOnap7KuV"},{"oauth_token": "1761827539700400128-74NfjPLnqF0OgXkPYuWHdyTSCa6NkI", "oauth_token_secret": "OQcrZloaTZeOoyoUaksuxXc1KNE8Nrjrvpn7RmvR7QbFH"},{"oauth_token": "1761829093257994240-dlu8XZKfTWIb9sNaGwZhdmBabPzUOs", "oauth_token_secret": "skHQVBzBIqjCAOkJorQymn5lkgs8x7yUOVHYPz9TwvFnx"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fly launch | ||
cat .env | fly secrets import | ||
fly scale count 1 | ||
fly deploy --ha=false | ||
fly deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
# twitter_login.py | ||
import requests | ||
import base64 | ||
import json | ||
|
||
username = "esther_mcc93968" | ||
password = "er68Bmi9o" | ||
TW_CONSUMER_KEY = "3nVuSoBZnx6U4vzUxf5w" | ||
TW_CONSUMER_SECRET = "Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys" | ||
TW_ANDROID_BASIC_TOKEN = "Basic {token}".format( | ||
token=base64.b64encode( | ||
(TW_CONSUMER_KEY + ":" + TW_CONSUMER_SECRET).encode() | ||
).decode() | ||
) | ||
# print(TW_ANDROID_BASIC_TOKEN) | ||
|
||
|
||
oauth_token = "" | ||
oauth_token_secret = "" | ||
authentication = None | ||
bearer_token_req = requests.post( | ||
"https://api.twitter.com/oauth2/token", | ||
headers={ | ||
"Authorization": TW_ANDROID_BASIC_TOKEN, | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
}, | ||
data="grant_type=client_credentials", | ||
).json() | ||
bearer_token = " ".join(str(x) for x in bearer_token_req.values()) | ||
print(bearer_token) | ||
|
||
# The bearer token is immutable | ||
# Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F | ||
guest_token = requests.post( | ||
"https://api.twitter.com/1.1/guest/activate.json", | ||
headers={ | ||
"Authorization": bearer_token, | ||
}, | ||
).json()["guest_token"] | ||
print(guest_token) | ||
|
||
twitter_header = { | ||
"Authorization": bearer_token, | ||
"Content-Type": "application/json", | ||
"User-Agent": "TwitterAndroid/9.95.0-release.0 (29950000-r-0) ONEPLUS+A3010/9 (OnePlus;ONEPLUS+A3010;OnePlus;OnePlus3;0;;1;2016)", | ||
"X-Twitter-API-Version": "5", | ||
"X-Twitter-Client": "TwitterAndroid", | ||
"X-Twitter-Client-Version": "9.95.0-release.0", | ||
"OS-Version": "28", | ||
"System-User-Agent": "Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A3010 Build/PKQ1.181203.001)", | ||
"X-Twitter-Active-User": "yes", | ||
"X-Guest-Token": guest_token, | ||
} | ||
|
||
session = requests.Session() | ||
|
||
|
||
task1 = session.post( | ||
"https://api.twitter.com/1.1/onboarding/task.json", | ||
params={ | ||
"flow_name": "login", | ||
"api_version": "1", | ||
"known_device_token": "", | ||
"sim_country_code": "us", | ||
}, | ||
json={ | ||
"flow_token": None, | ||
"input_flow_data": { | ||
"country_code": None, | ||
"flow_context": { | ||
"referrer_context": { | ||
"referral_details": "utm_source=google-play&utm_medium=organic", | ||
"referrer_url": "", | ||
}, | ||
"start_location": {"location": "deeplink"}, | ||
}, | ||
"requested_variant": None, | ||
"target_user_id": 0, | ||
}, | ||
}, | ||
headers=twitter_header, | ||
) | ||
|
||
session.headers["att"] = task1.headers.get("att") | ||
task2 = session.post( | ||
"https://api.twitter.com/1.1/onboarding/task.json", | ||
json={ | ||
"flow_token": task1.json().get("flow_token"), | ||
"subtask_inputs": [ | ||
{ | ||
"enter_text": { | ||
"suggestion_id": None, | ||
"text": username, | ||
"link": "next_link", | ||
}, | ||
"subtask_id": "LoginEnterUserIdentifier", | ||
} | ||
], | ||
}, | ||
headers=twitter_header, | ||
) | ||
|
||
task3 = session.post( | ||
"https://api.twitter.com/1.1/onboarding/task.json", | ||
json={ | ||
"flow_token": task2.json().get("flow_token"), | ||
"subtask_inputs": [ | ||
{ | ||
"enter_password": {"password": password, "link": "next_link"}, | ||
"subtask_id": "LoginEnterPassword", | ||
} | ||
], | ||
}, | ||
headers=twitter_header, | ||
) | ||
|
||
task4 = session.post( | ||
"https://api.twitter.com/1.1/onboarding/task.json", | ||
json={ | ||
"flow_token": task3.json().get("flow_token"), | ||
"subtask_inputs": [ | ||
{ | ||
"check_logged_in_account": {"link": "AccountDuplicationCheck_false"}, | ||
"subtask_id": "AccountDuplicationCheck", | ||
} | ||
], | ||
}, | ||
headers=twitter_header, | ||
).json() | ||
|
||
for t4_subtask in task4.get("subtasks", []): | ||
if "open_account" in t4_subtask: | ||
authentication = t4_subtask["open_account"] | ||
break | ||
elif "enter_text" in t4_subtask: | ||
response_text = t4_subtask["enter_text"]["hint_text"] | ||
code = input(f"Requesting {response_text}: ") | ||
task5 = session.post( | ||
"https://api.twitter.com/1.1/onboarding/task.json", | ||
json={ | ||
"flow_token": task4.get("flow_token"), | ||
"subtask_inputs": [ | ||
{ | ||
"enter_text": { | ||
"suggestion_id": None, | ||
"text": code, | ||
"link": "next_link", | ||
}, | ||
"subtask_id": "LoginTwoFactorAuthChallenge", | ||
} | ||
], | ||
}, | ||
headers=twitter_header, | ||
).json() | ||
print(task5) | ||
for t5_subtask in task5.get("subtasks", []): | ||
print(t5_subtask) | ||
if "open_account" in t5_subtask: | ||
authentication = t5_subtask["open_account"] | ||
oauth_token = t5_subtask["open_account"]["oauth_token"] | ||
oauth_token_secret = t5_subtask["open_account"]["oauth_token_secret"] | ||
|
||
print(authentication) | ||
|
||
# Constructing the new list of dictionaries with the extracted values | ||
output_list = [{ | ||
"oauth_token": oauth_token, | ||
"oauth_token_secret": oauth_token_secret | ||
}] | ||
|
||
# Converting the list back to a JSON string | ||
output_json = json.dumps(output_list) | ||
|
||
# Printing the result | ||
print(output_json) | ||
|
||
# { | ||
# 'attribution_event': 'login', | ||
# 'known_device_token': 'XXXXXXXXXXXXXXXXXXXXXX', | ||
# 'next_link': { | ||
# 'link_id': 'next_link', | ||
# 'link_type': 'subtask', | ||
# 'subtask_id': 'SuccessExit' | ||
# }, | ||
# 'oauth_token': 'XXXXXXXXXXXXXXXXXXXXXX', | ||
# 'oauth_token_secret': 'XXXXXXXXXXXXXXXXXXXXXX', | ||
# 'user': { | ||
# 'id': 'XXXXXXXXXXXXXXXXXXXXXX', | ||
# 'id_str': 'XXXXXXXXXXXXXXXXXXXXXX', | ||
# 'name': 'XXXXXXXXXXXXXXXXXXXXXX', | ||
# 'screen_name': 'XXXXXXXXXXXXXXXXXXXXXX' | ||
# } | ||
# } |
Oops, something went wrong.