various adjustments

This commit is contained in:
muskit
2023-08-30 02:26:45 -07:00
parent 4f519a9f55
commit 3ad7e42e73
3 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ from dotenv import dotenv_values
class AccountPool: class AccountPool:
def __init__(self): def __init__(self):
self.__accounts: list[tuple[str, str]] = list() self.__accounts: list[tuple[str, str]] = list()
self.__idx = -1 self.__idx = 0
creds = dotenv_values() creds = dotenv_values()
i = 0 i = 0
while True: while True:
+4
View File
@@ -25,11 +25,14 @@ async def get_cross_tweets_online():
global queue global queue
global scraper global scraper
safe_to_post_tweets = True
dbg_curr_user = ''
# Begin getting tweets from online # Begin getting tweets from online
print('Pulling tweets from online!') print('Pulling tweets from online!')
try: try:
for i, (talent_id, talent_username) in enumerate(talents.items()): for i, (talent_id, talent_username) in enumerate(talents.items()):
print(f'[{i+1}/{len(talents)}] {talent_username}-----------------------------------') print(f'[{i+1}/{len(talents)}] {talent_username}-----------------------------------')
dbg_curr_user = f'{talent_id}: {talent_username}'
try: try:
since_date = queue.finished_user_dates.get(talent_id, None) since_date = queue.finished_user_dates.get(talent_id, None)
ttweets = scraper.get_cross_ttweets_from_user(talent_username, since_date=since_date) ttweets = scraper.get_cross_ttweets_from_user(talent_username, since_date=since_date)
@@ -55,6 +58,7 @@ async def get_cross_tweets_online():
print('Unhandled error occurred while pulling tweets.') print('Unhandled error occurred while pulling tweets.')
traceback.print_exc() traceback.print_exc()
with open("error_catchup.txt", "a") as f: with open("error_catchup.txt", "a") as f:
f.write(f'Error getting tweets from user {dbg_curr_user}\n')
traceback.print_exc(file=f) traceback.print_exc(file=f)
safe_to_post_tweets = False safe_to_post_tweets = False
else: else:
+5 -5
View File
@@ -45,15 +45,15 @@ class Scraper:
def login_wait(self, private=False): def login_wait(self, private=False):
if private: if private:
print(f"keeping pvt-accessible account ({self.__account.use_index(0)[0]}). sleeping for 2 minutes...") print(f"keeping pvt-accessible account ({self.__account.use_index(0)[0]}). sleeping for 4 minutes...")
sleep(120) sleep(240)
print() print()
l = self.try_login(0) l = self.try_login(0)
else: else:
l = self.try_login() l = self.try_login()
if not l: if not l:
print("sleeping for 2 minutes...") print("sleeping for 4 minutes...")
sleep(120) sleep(240)
print() print()
self.try_login() self.try_login()
@@ -81,7 +81,7 @@ class Scraper:
return tweet return tweet
def get_tweet(self, id: int, private_user=False): def get_tweet(self, id: int, private_user=False):
print(f'{id}{" on private" if private_user else ""}') # print(f'{id}{" on private" if private_user else ""}')
if private_user: if private_user:
self.try_login(0) self.try_login(0)
while True: while True: