diff options
author | makefu <github@syntax-fehler.de> | 2020-04-01 00:03:40 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2020-04-01 00:03:40 +0200 |
commit | 6c54ff705e5c1133a46039cf654ac54cd4179955 (patch) | |
tree | 87ab794382758b27ccdfb7b3bfb9a48cd84f5663 /ebknotify/cache.py | |
parent | ffef23f1854d8166eec75a5d94b2524a63e6e06c (diff) |
ebknotify: add more info
Diffstat (limited to 'ebknotify/cache.py')
-rw-r--r-- | ebknotify/cache.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ebknotify/cache.py b/ebknotify/cache.py index fbc4b9b..d1188dd 100644 --- a/ebknotify/cache.py +++ b/ebknotify/cache.py @@ -47,10 +47,16 @@ class Cache(): title = ad.get('title', {}).get('value', '').encode('utf-8') title_unescaped = html_unescape(title) try: - img = ad['pictures']['picture'][0]['link'][4]['href'] + img = ad['pictures']['picture'][0]['link'][3]['href'] except Exception as e: - print(e) img = None + try: + place = ad['locations']['location'][0]['localized-name']['value'] + radius = ad['locations']['location'][0]['radius']['value'] + except Exception as e: + print(e) + place = None + radius = None # TODO: fetch detailed article ad['notify'] = { 'filter': searchquery, @@ -59,6 +65,8 @@ class Cache(): 'first-seen': now.isoformat(), 'title-unescaped': title_unescaped, 'age_in_h': age_in_h, + 'place': place, + 'radius': radius, 'price': price, 'image': img, 'url': ad['link'][1]['href'], |