Add API_SEARCH_KEY to environment variables and update main functionality to use it for searches

This commit is contained in:
fzzinchemical
2025-11-13 22:27:49 +01:00
parent 986e7f2564
commit 6b5f05fd0e
2 changed files with 4 additions and 2 deletions

View File

@@ -3,4 +3,5 @@ COOKIES=""
USERNAME=""
PASSWORD=""
EMAIL=""
EMAIL_PASSWORD=""
EMAIL_PASSWORD=""
API_SEARCH_KEY=""

View File

@@ -46,6 +46,7 @@ async def main():
password = os.getenv("PASSWORD")
email = os.getenv("EMAIL")
email_password = os.getenv("EMAIL_PASSWORD")
api_search_key = os.getenv("API_SEARCH_KEY")
await api.pool.add_account(username, password, email, email_password, cookies=cookies)
await api.pool.login_all() # try to login to receive account cookies
@@ -55,7 +56,7 @@ async def main():
if check_if_json_exists(OUTPUT_FILE):
_results = load_json(OUTPUT_FILE).get("tweets", [])
async for rep in api.search("AI"):
async for rep in api.search(api_search_key):
try:
_results.append(rep.json())
logger.info("Appended tweet JSON")