nanos / FediFetcher

FediFetcher is a tool for Mastodon that automatically fetches missing replies and posts from other fediverse instances, and adds them to your own Mastodon instance.
https://blog.thms.uk/fedifetcher?utm_source=github
MIT License
293 stars 213 forks source link

Error on first run #99

Closed piratenpanda closed 4 months ago

piratenpanda commented 4 months ago

After running for a while I got the following error:

2024-02-07 12:17:40.325686 UTC: Job failed after 0:04:55.614553.
Traceback (most recent call last):
  File "/var/www/html/FediFetcher/find_posts.py", line 1417, in <module>
    followings = get_new_followings(arguments.server, user_id, arguments.max_followings, all_known_users)
  File "/var/www/html/FediFetcher/find_posts.py", line 274, in get_new_followings
    following = get_paginated_mastodon(f"https://{server}/api/v1/accounts/{user_id}/following", max)
  File "/var/www/html/FediFetcher/find_posts.py", line 933, in get_paginated_mastodon
    result = response.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

config is:

{
  "access-token": "*",
  "server": "*",
  "home-timeline-length": 200,
  "max-followings": 80,
  "max-favourites": 40,
  "from-notifications": 1
}

python version 3.10.12

Is this a wrongly returned answer from another server?

piratenpanda commented 4 months ago

I'm also getting lots of these

024-02-07 12:23:27.963377 UTC: Error getting context for toot https://pixelfed.social/p/Laszlo/659851707082890915. Status code: 404
2024-02-07 12:23:28.712389 UTC: Error getting context for toot https://pixelfed.social/p/Laszlo/659850216653363923. Status code: 404
2024-02-07 12:23:29.766773 UTC: Error getting context for toot https://pixelfed.social/p/adabo/659755519167156599. Status code: 404
2024-02-07 12:23:31.706399 UTC: Error getting context for toot https://pixelfed.social/p/nhoizey/659744658703592031. Status code: 404
2024-02-07 12:23:32.969279 UTC: Error getting context for toot https://pixelfed.social/p/nhoizey/659568921637010071. Status code: 404
2024-02-07 12:23:33.071992 UTC: Error parsing context for toot https://pixelfed.de/p/farn/659517555946709276. Exception: Expecting value: line 1 column 1 (char 0)
2024-02-07 12:23:33.283327 UTC: Error parsing context for toot https://pixelfed.de/p/farn/659517014913478822. Exception: Expecting value: line 1 column 1 (char 0)
2024-02-07 12:23:33.405179 UTC: Error parsing context for toot https://pixelfed.de/p/farn/659516614383161393. Exception: Expecting value: line 1 column 1 (char 0)
piratenpanda commented 4 months ago

Fails at the same position each time:

2024-02-07 12:25:23.832379 UTC: Error getting user ID for user Laszlo: User Laszlo was not found on server pixelfed.social.
2024-02-07 12:25:24.474016 UTC: Error getting user ID for user savvdm: User savvdm was not found on server pixelfed.social.
2024-02-07 12:25:24.571032 UTC: Error getting user ID for user farn: Expecting value: line 1 column 1 (char 0)
2024-02-07 12:25:25.224172 UTC: Error getting user ID for user adabo: User adabo was not found on server pixelfed.social.
2024-02-07 12:25:25.224327 UTC: Getting posts from last 80 followings
2024-02-07 12:25:25.375680 UTC: Job failed after 0:02:19.852473.
Traceback (most recent call last):
  File "/var/www/html/FediFetcher/find_posts.py", line 1417, in <module>
    followings = get_new_followings(arguments.server, user_id, arguments.max_followings, all_known_users)
  File "/var/www/html/FediFetcher/find_posts.py", line 274, in get_new_followings
    following = get_paginated_mastodon(f"https://{server}/api/v1/accounts/{user_id}/following", max)
  File "/var/www/html/FediFetcher/find_posts.py", line 933, in get_paginated_mastodon
    result = response.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
nanos commented 4 months ago

The problem is that your JSON is incorrect: Your first line is "access-token": "*"> i.e. it ends with a >. It needs to end with a ,.

piratenpanda commented 4 months ago

ah this was a typo while copying from nano. It's correctly set up. It always dies when reaching the followings part

nanos commented 4 months ago

Is your server a mastodon server?

piratenpanda commented 4 months ago

It's a pixelfed server running latest code

nanos commented 4 months ago

Then you can't use FediFetcher, I'm afraid. While FediFetcher can fetch posts from pixelfed, it cannot import posts into pixelfed. Sorry.