added hashtags
This commit is contained in:
26
README.md
26
README.md
@ -1,6 +1,6 @@
|
|||||||
*feediverse* will read RSS/Atom feeds and send the messages as Mastodon posts.
|
*feediverse* will read RSS/Atom feeds and send the messages as Mastodon posts.
|
||||||
It's kind of the same thing as [feed2toot] but just one module that works with
|
Please use responsibly! *feediverse* is kind of the same thing as [feed2toot]
|
||||||
Python 3.
|
but it's just one module that works with Python 3 ... and I was bored.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
@ -26,10 +26,14 @@ format is:
|
|||||||
|
|
||||||
{title} {url}
|
{title} {url}
|
||||||
|
|
||||||
But you can use the `{summary}` as well, and also add text like so:
|
If you want you can use `{summary}` in your template, and add boilerplate text
|
||||||
|
like so:
|
||||||
|
|
||||||
Bookmark: {title} {url} {summary}
|
Bookmark: {title} {url} {summary}
|
||||||
|
|
||||||
|
`{hashtags}` will look for tags in the feed entry and turn them into a space
|
||||||
|
separated list of hashtags.
|
||||||
|
|
||||||
## Multiple Feeds
|
## Multiple Feeds
|
||||||
|
|
||||||
Since *feeds* is a list you can add additional feeds to watch if you want.
|
Since *feeds* is a list you can add additional feeds to watch if you want.
|
||||||
@ -43,14 +47,16 @@ Since *feeds* is a list you can add additional feeds to watch if you want.
|
|||||||
|
|
||||||
## Why?
|
## Why?
|
||||||
|
|
||||||
I created *feediverse* because I wanted to send my Pinboard bookmarks to Mastodon.
|
I created *feediverse* because I wanted to send my Pinboard bookmarks to
|
||||||
I've got an IFTTT recipe that does this for Twitter, but IFTTT doesn't appear to
|
Mastodon. I've got an IFTTT recipe that does this for Twitter, but IFTTT
|
||||||
work with Mastodon yet.
|
doesn't appear to work with Mastodon yet. That being said *feediverse* should
|
||||||
|
work with any RSS or Atom feed (thanks to [feedparser]).
|
||||||
|
|
||||||
That being said *feediverse* should work with any RSS or Atom feed (thanks to
|
## Warning!
|
||||||
[feedparser]). But please be responsible. Don't fill up Mastodon with tons of
|
|
||||||
junk just because you can. That kind of toxic behavior is why a lot of people
|
Please be responsible. Don't fill up Mastodon with tons of junk just because you
|
||||||
are leaving other social media platforms and trying to start over in Mastodon.
|
can. That kind of toxic behavior is why a lot of people are trying to establish
|
||||||
|
other forms of social media like Mastodon.
|
||||||
|
|
||||||
[feed2toot]: https://gitlab.com/chaica/feed2toot/
|
[feed2toot]: https://gitlab.com/chaica/feed2toot/
|
||||||
[feedparser]: http://feedparser.org/
|
[feedparser]: http://feedparser.org/
|
||||||
|
|||||||
@ -30,6 +30,13 @@ def main():
|
|||||||
|
|
||||||
save_config(config, config_file)
|
save_config(config, config_file)
|
||||||
|
|
||||||
|
def get_config_file():
|
||||||
|
if __name__ == "__main__" and len(sys.argv) > 1:
|
||||||
|
config_file = sys.argv[1]
|
||||||
|
else:
|
||||||
|
config_file = os.path.join(os.path.expanduser("~"), ".feediverse")
|
||||||
|
return config_file
|
||||||
|
|
||||||
def save_config(config, config_file):
|
def save_config(config, config_file):
|
||||||
copy = dict(config)
|
copy = dict(config)
|
||||||
copy['updated'] = datetime.now(tz=timezone.utc).isoformat()
|
copy['updated'] = datetime.now(tz=timezone.utc).isoformat()
|
||||||
@ -57,10 +64,14 @@ def get_feed(feed_url, last_update):
|
|||||||
return new_entries
|
return new_entries
|
||||||
|
|
||||||
def get_entry(entry):
|
def get_entry(entry):
|
||||||
|
hashtags = []
|
||||||
|
for tag in entry.get('tags', []):
|
||||||
|
hashtags.add('#{}'.format(tag.value))
|
||||||
return {
|
return {
|
||||||
'url': entry.id,
|
'url': entry.id,
|
||||||
'title': entry.title,
|
'title': entry.title,
|
||||||
'summary': entry.get('summary', ''),
|
'summary': entry.get('summary', ''),
|
||||||
|
'hashtags': ' '.join(hashtags),
|
||||||
'updated': dateutil.parser.parse(entry['updated']),
|
'updated': dateutil.parser.parse(entry['updated']),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,12 +108,5 @@ def setup(config_file):
|
|||||||
print("Add a line line this to your crontab to check every 15 minutes:")
|
print("Add a line line this to your crontab to check every 15 minutes:")
|
||||||
print("*/15 * * * * /usr/local/bin/feediverse")
|
print("*/15 * * * * /usr/local/bin/feediverse")
|
||||||
|
|
||||||
def get_config_file():
|
|
||||||
if __name__ == "__main__" and len(sys.argv) > 1:
|
|
||||||
config_file = sys.argv[1]
|
|
||||||
else:
|
|
||||||
config_file = os.path.join(os.path.expanduser("~"), ".feediverse")
|
|
||||||
return config_file
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='feediverse',
|
name='feediverse',
|
||||||
version='0.0.1',
|
version='0.0.2',
|
||||||
url='https://github.com/edsu/feediverse',
|
url='https://github.com/edsu/feediverse',
|
||||||
author='Ed Summers',
|
author='Ed Summers',
|
||||||
author_email='ehs@pobox.com',
|
author_email='ehs@pobox.com',
|
||||||
|
|||||||
Reference in New Issue
Block a user