Changed login order to accommodate 2fa, added prompt, change language on ratelimit waiting

This commit is contained in:
Salastil
2025-03-13 16:09:39 -04:00
parent c7715ae291
commit 59967225b5
2 changed files with 7 additions and 5 deletions

View File

@@ -20,7 +20,7 @@ class Progress:
if no_tweets_limit: if no_tweets_limit:
if waiting: if waiting:
sys.stdout.write( sys.stdout.write(
"\rTweets scraped : {} - waiting to access older tweets {} min on 15 min".format( "\rTweets scraped : {} - Rate Limited: waiting to access older tweets. Attempt to proceed {} over 15 min".format(
current, retry_cnt current, retry_cnt
) )
) )

View File

@@ -212,8 +212,8 @@ class Twitter_Scraper:
sleep(3) sleep(3)
self._input_username() self._input_username()
self._input_unusual_activity()
self._input_password() self._input_password()
self._input_unusual_activity()
cookies = self.driver.get_cookies() cookies = self.driver.get_cookies()
@@ -283,7 +283,9 @@ It may be due to the following:
unusual_activity = self.driver.find_element( unusual_activity = self.driver.find_element(
"xpath", "//input[@data-testid='ocfEnterTextTextInput']" "xpath", "//input[@data-testid='ocfEnterTextTextInput']"
) )
unusual_activity.send_keys(self.username) # Prompt for 2FA code input
two_fa_code = input("Enter 2FA code: ").strip()
unusual_activity.send_keys(two_fa_code)
unusual_activity.send_keys(Keys.RETURN) unusual_activity.send_keys(Keys.RETURN)
sleep(3) sleep(3)
break break