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
loops = 0
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:
if(status.created_at.year < current_year):
stop = True
break
for mention in status.mentions:
if mention.username == bot_name or mention.username == status.account.username:
print("skipping: " + mention.username)
pass
else:
if mention.id not in accounts:
accounts[mention.id] = 1
@ -62,10 +62,14 @@ def get_ordered_accounts_ids(account_id):
def get_accounts(accounts_ids):
accounts = []
for i in range(len(accounts_ids)):
account = api.account(accounts_ids[i])
accounts.append(account)
if len(accounts) == len(coordinates):
break
try:
account = api.account(accounts_ids[i])
accounts.append(account)
if len(accounts) == len(coordinates):
break
except Exception as e:
print(e)
print("Failed to get account id: " + accounts_ids[i])
return accounts
def get_avatar():