From fbde3cb9119361f320eb9cd160aef01a947e4c08 Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Sun, 8 Mar 2020 19:57:06 +1000 Subject: [PATCH] only use pleroma mode if 'prev' key exists, handle final page better --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index b9fe691..f2a536f 100755 --- a/main.py +++ b/main.py @@ -193,7 +193,7 @@ for f in following: sys.exit(1) pleroma = False - if 'next' not in j: + if 'next' not in j and 'prev' in j: print("Using Pleroma compatibility mode") pleroma = True j = j['first'] @@ -243,6 +243,8 @@ for f in following: r = requests.get(j['next'], timeout=15) except requests.Timeout: print("HTTP timeout, site did not respond within 15 seconds") + except KeyError: + print("Couldn't get next page - we've probably got all the posts") except: print("An error occurred while trying to obtain more posts.")