From 7504f951864887fc0de0752670967576120d7284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Podgor=C5=A1ek?= Date: Thu, 23 Sep 2021 23:19:16 +0200 Subject: [PATCH] RSS bralnik v pythonu --- mobili_cli/utils/authenticate.py | 2 +- mobili_cli/utils/load-rss-feed.py | 16 ++++++++++++++++ primeri/izpisi-neodvisni.sh | 5 +++++ requirements.txt | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) mode change 100644 => 100755 mobili_cli/utils/authenticate.py create mode 100755 mobili_cli/utils/load-rss-feed.py create mode 100755 primeri/izpisi-neodvisni.sh create mode 100644 requirements.txt diff --git a/mobili_cli/utils/authenticate.py b/mobili_cli/utils/authenticate.py old mode 100644 new mode 100755 index 7625832..83b9c89 --- a/mobili_cli/utils/authenticate.py +++ b/mobili_cli/utils/authenticate.py @@ -2,7 +2,7 @@ import sys import json -import sgqlc.endpoint.http import HTTPEndpoint +from sgqlc.endpoint.http import HTTPEndpoint mutation = """ diff --git a/mobili_cli/utils/load-rss-feed.py b/mobili_cli/utils/load-rss-feed.py new file mode 100755 index 0000000..cc124e6 --- /dev/null +++ b/mobili_cli/utils/load-rss-feed.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import sys +import feedparser + +try: + url = sys.argv[1] + + f = feedparser.parse(url) + for dogodek in f['entries']: + print(dogodek) + +except ValueError: + raise SystemExit('Usage: load-rss-feed.py ') + + diff --git a/primeri/izpisi-neodvisni.sh b/primeri/izpisi-neodvisni.sh new file mode 100755 index 0000000..2970d4b --- /dev/null +++ b/primeri/izpisi-neodvisni.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +url="https://www.neodvisni.art/novice/feed" + +../mobili_cli/utils/load-rss-feed.py $url diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..614b2ca --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +sgqlc==v14.1 +feedparser==6.0.8