summaryrefslogtreecommitdiff
path: root/netto.py
diff options
context:
space:
mode:
authorAndré Glüpker <git@wgmd.de>2021-05-09 20:13:08 +0200
committerAndré Glüpker <git@wgmd.de>2021-05-09 20:23:18 +0200
commit93f3613dab38125d9ae7d5e74498c5395ac80ab0 (patch)
tree4f1a80138a83c98348464f1b9ddd949766441488 /netto.py
parent5774dbfb2caa42cb55bafab98a40e47f395e44d9 (diff)
downloadrss-feeds-93f3613dab38125d9ae7d5e74498c5395ac80ab0.tar.gz
rss-feeds-93f3613dab38125d9ae7d5e74498c5395ac80ab0.tar.bz2
rss-feeds-93f3613dab38125d9ae7d5e74498c5395ac80ab0.zip
Unify method returns / return RSS object
Diffstat (limited to 'netto.py')
-rwxr-xr-xnetto.py37
1 files changed, 12 insertions, 25 deletions
diff --git a/netto.py b/netto.py
index fda6409..2867edf 100755
--- a/netto.py
+++ b/netto.py
@@ -36,34 +36,21 @@ def netto(store_id):
year = str(datetime.now().year)
title = url[ url.find(year) : url.find(year) + 7 ]
- return title, url
+ return {
+ title: 'Netto Angebote für ' + store_id,
+ url: 'https://www.netto-online.de/ueber-netto/Online-Prospekte.chtm/' + store_id,
+ description: 'PDF der neuen Netto Angebote für den Laden um die Ecke.',
+ content: [{
+ 'title': 'Angebote für ' + title,
+ 'url': url,
+ 'content': 'Angebote für ' + title + ' finden sich unter ' + url,
+ }]
+ }
-def main(store_id = 9110):
- url = 'https://www.netto-online.de/ueber-netto/Online-Prospekte.chtm/' + str(store_id)
- print("""<?xml version="1.0" encoding="UTF-8"?>
-<rss version="2.0">
- <channel>
- <title>Netto Angebote """ + str(store_id) + """</title>
- <link>""" + url + """</link>
- <description>PDF der neuen Netto Angebote für den Laden um die Ecke.</description>
- <lastBuildDate>""" + _format_date(datetime.now()) + """</lastBuildDate>""")
-
- title, link = netto(url)
- print(' <item>')
- print(' <title><![CDATA[Angebote für ' + title + ']]></title>')
- print(' <link>' + link + '</link>')
- # print(' <description><![CDATA[' + description + ']]></description>')
- # print(' <pubDate>' + date + '</pubDate>')
- # print(' <media:content url="' + thumbnail + b'" type="image/jpeg" />')
- print(' </item>')
+def main(store_id = 9110):
+ print(netto(store_id))
- print(' </channel>')
- print('</rss>')
if __name__ == "__main__":
- # if len(sys.argv) != 2:
- # print('Usage:', sys.argv[0], '<foobar>')
- # sys.exit(1)
- # main(sys.argv[1])
main()