handle errored user accounts

This commit is contained in:
Moon Man 2024-12-16 14:48:10 +00:00
parent 72eac07711
commit 106a487dc5
1 changed files with 10 additions and 6 deletions

View File

@ -37,14 +37,14 @@ def get_ordered_accounts_ids(account_id):
max_id=None max_id=None
loops = 0 loops = 0
while stop == False: while stop == False:
statuses = api.account_statuses(account_id, exclude_reblogs=True, max_id=max_id, limit=40) statuses = api.account_statuses(account_id, exclude_reblogs=True, max_id=max_id, limit=50)
for status in statuses: for status in statuses:
if(status.created_at.year < current_year): if(status.created_at.year < current_year):
stop = True stop = True
break break
for mention in status.mentions: for mention in status.mentions:
if mention.username == bot_name or mention.username == status.account.username: if mention.username == bot_name or mention.username == status.account.username:
print("skipping: " + mention.username) pass
else: else:
if mention.id not in accounts: if mention.id not in accounts:
accounts[mention.id] = 1 accounts[mention.id] = 1
@ -62,10 +62,14 @@ def get_ordered_accounts_ids(account_id):
def get_accounts(accounts_ids): def get_accounts(accounts_ids):
accounts = [] accounts = []
for i in range(len(accounts_ids)): for i in range(len(accounts_ids)):
try:
account = api.account(accounts_ids[i]) account = api.account(accounts_ids[i])
accounts.append(account) accounts.append(account)
if len(accounts) == len(coordinates): if len(accounts) == len(coordinates):
break break
except Exception as e:
print(e)
print("Failed to get account id: " + accounts_ids[i])
return accounts return accounts
def get_avatar(): def get_avatar():