Created
November 18, 2022 16:53
-
-
Save jpmens/f17ab7a4a202e9f377a2da1f59a4a7fc to your computer and use it in GitHub Desktop.
RSStoMadon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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