Skip to content

Instantly share code, notes, and snippets.

@jpmens
Created November 18, 2022 16:53
Show Gist options
  • Save jpmens/f17ab7a4a202e9f377a2da1f59a4a7fc to your computer and use it in GitHub Desktop.
Save jpmens/f17ab7a4a202e9f377a2da1f59a4a7fc to your computer and use it in GitHub Desktop.
RSStoMadon
#!/usr/bin/env python3
import feedparser
from mastodon import Mastodon
MASTODON_BASE_URL = 'https://mastodon.social'
CLIENTCRED = 'JP_appsecret.txt'
USERCRED = 'JP_usersecret.txt'
mastodon = Mastodon(
client_id = CLIENTCRED,
access_token = USERCRED,
api_base_url = MASTODON_BASE_URL
)
Feed = feedparser.parse('https://binblog.de/feed/')
for p in Feed.entries:
t = """
{summary}
{link}
# rss
"""
text = t.format(summary=p.summary, link=p.link)
print(text)
r = mastodon.status_post(text, visibility='private')
print(r)
exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment