diff options
author | André Glüpker <git@wgmd.de> | 2021-05-09 20:13:08 +0200 |
---|---|---|
committer | André Glüpker <git@wgmd.de> | 2021-05-09 20:23:18 +0200 |
commit | 93f3613dab38125d9ae7d5e74498c5395ac80ab0 (patch) | |
tree | 4f1a80138a83c98348464f1b9ddd949766441488 /netto.py | |
parent | 5774dbfb2caa42cb55bafab98a40e47f395e44d9 (diff) | |
download | rss-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-x | netto.py | 37 |
1 files changed, 12 insertions, 25 deletions
@@ -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() |