From 6c54ff705e5c1133a46039cf654ac54cd4179955 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 1 Apr 2020 00:03:40 +0200 Subject: ebknotify: add more info --- ebknotify/cache.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ebknotify/cache.py') 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'], -- cgit v1.2.3