From 5d62b17310be70cadde1152decf785d7ae82609c Mon Sep 17 00:00:00 2001 From: Lynne Date: Thu, 7 Feb 2019 10:53:23 +1000 Subject: [PATCH] removed hacky solution, added misskey support --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 6d3e921..45297e5 100755 --- a/main.py +++ b/main.py @@ -114,10 +114,10 @@ for f in following: uri = uri.format(uri = "{}@{}".format(f.username, instance)) r = requests.get(uri, headers={"Accept": "application/json"}, timeout=10) j = r.json() - if len(j['aliases']) == 1: #TODO: this is a hack on top of a hack, fix it - uri = j['aliases'][0] - else: - uri = j['aliases'][1] + for link in j['links']: + if link['rel'] == 'self': + #this is a link formatted like "https://instan.ce/users/username", which is what we need + uri = link['href'] uri = "{}/outbox?page=true".format(uri) r = requests.get(uri, timeout=10) j = r.json() @@ -131,7 +131,7 @@ for f in following: pleroma = True j = j['first'] else: - print("Mastodon instance detected") + print("Mastodon/Misskey instance detected") uri = "{}&min_id={}".format(uri, last_toot) r = requests.get(uri) j = r.json()