import feedparser,re,time,requests from mastodon import Mastodon posts = [] with open(LOGFILE,"r") as log: last = log.read() rss = feedparser.parse(RSS) guids = [] for entry in rss.entries: if entry.guid == last: break else: thestring = "[LINK TEXT](" + entry.link + ") " + entry.summary + " #TAG" posts.append(thestring) guids.append(entry.guid) # repeat the above for each rss feed mastodon = Mastodon(access_token="TOKEN",api_base_url="https://kes.praze.net", feature_set="pleroma",version_check_mode="none") if len(posts) > 0: try: posts = posts[::-1] except: pass for post in posts: mastodon.status_post(post,content_type="text/markdown") time.sleep(10) # repeat the below for each rss feed if len(guids) > 0: with open(LOGFILE,"w") as log: log.write(guids[0])