diff options
author | André Glüpker <git@wgmd.de> | 2024-05-01 11:20:22 +0200 |
---|---|---|
committer | André Glüpker <git@wgmd.de> | 2024-05-01 11:29:50 +0200 |
commit | b5241f3b4ca53a297b6046fc1d755a55d90e05aa (patch) | |
tree | 1ed0b987b63f4c2243dfbc212c8220388a1b56ad /webapp.py | |
parent | 389f40f305a6ab41b9636cd9fe29420600bc5c73 (diff) | |
download | rss-feeds-b5241f3b4ca53a297b6046fc1d755a55d90e05aa.tar.gz rss-feeds-b5241f3b4ca53a297b6046fc1d755a55d90e05aa.tar.bz2 rss-feeds-b5241f3b4ca53a297b6046fc1d755a55d90e05aa.zip |
Add /delta to crawl for webpage changes
Diffstat (limited to 'webapp.py')
-rwxr-xr-x | webapp.py | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -2,16 +2,18 @@ import logging -from flask import Flask, Response +from flask import Flask, Response, request +from rss_types import RSSFeed from rss import buildRSS from zdf import zdf +from urldelta import get_page_delta app = Flask(__name__) app.secret_key = "NMcgoB.0wd+$.KVKj!F{3>U{%BBUVhL=7=5$:46rQH$Q{enCuU" -def rssResponse(data): +def rssResponse(data: RSSFeed): rss = buildRSS(data) response = Response(rss, mimetype="text/xml") response.headers["Access-Control-Allow-Origin"] = "*" @@ -30,7 +32,16 @@ def not_found(e): @app.route("/zdf/<path:show_url>") def fetch_zdf_show(show_url): - return rssResponse(zdf(show_url)) + if rss_feed := zdf(show_url): + return rssResponse(rss_feed) + return "Failed" + + +@app.route("/delta") +def website_delta(): + if url := request.args.get("url"): + return rssResponse(get_page_delta(url)) + return "Failed" if __name__ == "__main__": |