had a proper look at the code and fixed it for realsies this time. i'm a dunce.
This commit is contained in:
parent
1940175f19
commit
26541940b7
14
main.py
14
main.py
|
@ -168,16 +168,16 @@ for f in following:
|
||||||
print("Pleroma instance detected")
|
print("Pleroma instance detected")
|
||||||
pleroma = True
|
pleroma = True
|
||||||
j = j['first']
|
j = j['first']
|
||||||
|
else:
|
||||||
if not pleroma:
|
|
||||||
print("Mastodon instance detected")
|
print("Mastodon instance detected")
|
||||||
uri = "{}/outbox?page=true&min_id={}".format(uri, last_toot)
|
uri = "{}&min_id={}".format(uri, last_toot)
|
||||||
|
print(uri)
|
||||||
r = requests.get(uri)
|
r = requests.get(uri)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
|
|
||||||
print("Downloading and parsing toots", end='', flush=True)
|
print("Downloading and parsing toots", end='', flush=True)
|
||||||
done = False
|
done = False
|
||||||
try:
|
if True:
|
||||||
while not done and len(j['orderedItems']) > 0:
|
while not done and len(j['orderedItems']) > 0:
|
||||||
for oi in j['orderedItems']:
|
for oi in j['orderedItems']:
|
||||||
# if (not pleroma and oi['type'] == "Create") or (pleroma and oi['to']['type'] == "Create"):
|
# if (not pleroma and oi['type'] == "Create") or (pleroma and oi['to']['type'] == "Create"):
|
||||||
|
@ -215,9 +215,9 @@ for f in following:
|
||||||
print('.', end='', flush=True)
|
print('.', end='', flush=True)
|
||||||
print(" Done!")
|
print(" Done!")
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
# except:
|
||||||
print("Encountered an error! Saving toots to database and continuing.")
|
# print("Encountered an error! Saving toots to database and continuing.")
|
||||||
db.commit()
|
# db.commit()
|
||||||
# db.close()
|
# db.close()
|
||||||
|
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
Loading…
Reference in New Issue