removed hacky solution, added misskey support
This commit is contained in:
parent
213c40351d
commit
5d62b17310
1 changed files with 5 additions and 5 deletions
10
main.py
10
main.py
|
@ -114,10 +114,10 @@ for f in following:
|
||||||
uri = uri.format(uri = "{}@{}".format(f.username, instance))
|
uri = uri.format(uri = "{}@{}".format(f.username, instance))
|
||||||
r = requests.get(uri, headers={"Accept": "application/json"}, timeout=10)
|
r = requests.get(uri, headers={"Accept": "application/json"}, timeout=10)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
if len(j['aliases']) == 1: #TODO: this is a hack on top of a hack, fix it
|
for link in j['links']:
|
||||||
uri = j['aliases'][0]
|
if link['rel'] == 'self':
|
||||||
else:
|
#this is a link formatted like "https://instan.ce/users/username", which is what we need
|
||||||
uri = j['aliases'][1]
|
uri = link['href']
|
||||||
uri = "{}/outbox?page=true".format(uri)
|
uri = "{}/outbox?page=true".format(uri)
|
||||||
r = requests.get(uri, timeout=10)
|
r = requests.get(uri, timeout=10)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
|
@ -131,7 +131,7 @@ for f in following:
|
||||||
pleroma = True
|
pleroma = True
|
||||||
j = j['first']
|
j = j['first']
|
||||||
else:
|
else:
|
||||||
print("Mastodon instance detected")
|
print("Mastodon/Misskey instance detected")
|
||||||
uri = "{}&min_id={}".format(uri, last_toot)
|
uri = "{}&min_id={}".format(uri, last_toot)
|
||||||
r = requests.get(uri)
|
r = requests.get(uri)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
|
|
Loading…
Reference in a new issue