edsu / feediverse

Send RSS/Atom feeds to Mastodon
MIT License
113 stars 23 forks source link

categories in the feed aren't added as hashtags to the toot #11

Closed steinarb closed 4 years ago

steinarb commented 4 years ago

Platform: amd64, debian 10.4 "buster", feediverse-0.0.11, feediverse-0.0.11 feedparser-5.2.1 mastodon.py-1.5.1, python 3.7.3

I have this feed that I'm trying to use feediverse to add to mastodon: https://steinar.bang.priv.no/feed/atom/

The feediverse code tries to add the categories as hashtags https://github.com/edsu/feediverse/blob/master/feediverse.py#L66

But as far as I can tell, the hashtags aren't appearing in mastodon.

Here's a toot created by feediverse: https://mastodon.social/@steinarb/104291594180415614

The toot should have had the hashtags "#apachekaraf, #javaprogramming, #declarativeservices, #derby, #jdbc, #karaf, #liquibase, #osgi, #osgiservices, #paxjdbc, #paxjdbcconfig, #postgresql".

But if the hashtags are present in the toot, I can't see them or find them.

steinarb commented 4 years ago

The code in https://github.com/edsu/feediverse/blob/master/feediverse.py#L66 prepends a "#" to each tag, and joins the tags space separated into a string value, put in the field hashtags.

As far as I can tell, the mastodon REST API will just drop the hashtags value on the floor: (there is no field hashtags in the body of the POST to /api/v1/statuses : https://docs.joinmastodon.org/methods/statuses/

steinarb commented 4 years ago

Hm... that was a wrong conclusion.

The entry returned by get_item is formatted into a string here https://github.com/edsu/feediverse/blob/master/feediverse.py#L28

The formatted string is sent as argument "status" to Mastodon.status_post() https://github.com/halcy/Mastodon.py/blob/master/mastodon/Mastodon.py#L1648

And the feed['template'] was default '{title} {url}' which I've now changed to {title} {hashtags} {url}'.

We'll see if that makes a difference?

steinarb commented 4 years ago

Adding '{hashtags}' to the template caused the hashtags to appear in the toots.

Not a bug.