#!/usr/bin/env python3 # usage: fedipost.py jsonfeed_url webhook_url [filter_text] # e.g: fedipost.py https://blahaj.zone/@alypet.json webhook #alyblog from markdownify import markdownify from requests import get,post import os, sys WH = sys.argv[2] try: with open("posts.txt") as f: posts = f.read().strip().split("\n") except: posts = [] feed = get(sys.argv[1]).json() items = [] for item in feed["items"]: if item["url"] in posts: continue if len(sys.argv) > 3: if sys.argv[3] not in item["content_html"]: continue content, img_url = item["content_html"].split('