diff --git a/fdb_spider_interface.py b/fdb_spider_interface.py index 04bdf01..7f2ea0b 100644 --- a/fdb_spider_interface.py +++ b/fdb_spider_interface.py @@ -120,26 +120,29 @@ if __name__ == '__main__': data[room_fdb] = iterdict - for i in eval(iteration_var_list): - - for key in data[room_fdb][i]: - contains_tag = False - for tag in eval(room_tags): - if tag in (data[room_fdb][i][key]["name"].split(' ') or data[room_fdb][i][key]["info"].split(' ') or data[room_fdb][i][key]["text"].split(' ')): - contains_tag = True - if contains_tag == True: + for i in eval(iteration_var_list): + try: + print(room_fdb, i) + for key in data[room_fdb][i]: + contains_tag = False + for tag in eval(room_tags): + if tag in (data[room_fdb][i][key]["name"].split(' ') or data[room_fdb][i][key]["info"].split(' ') or data[room_fdb][i][key]["text"].split(' ')): + contains_tag = True + if contains_tag == True: - try: - url = data[room_fdb][i][key]["domain"] - except: - url = data[room_fdb][i][key]["link"] + try: + url = data[room_fdb][i][key]["domain"] + except: + url = data[room_fdb][i][key]["link"] - entry_message = '[' + url + ']' + data[room_fdb][i][key]["name"] + '\n' + data[room_fdb][i][key]["info"] + entry_message = '<' + url + '|' + data[room_fdb][i][key]["name"]+ '>' + '\n' + data[room_fdb][i][key]["info"] - api.send_message(entry_message, room[0]) - + api.send_message(entry_message, room[0]) + + except Exception as e: + print("probably i was not there in last page, original error is:", e) diff --git a/new_message_file.txt b/new_message_file.txt index 0b6c761..11a6f40 100644 --- a/new_message_file.txt +++ b/new_message_file.txt @@ -1 +1 @@ -printfdbs§%§%cm9qFkkcbXdKuzXmC \ No newline at end of file +createroom fdbspider-mobi ['giz','foerderinfo.bund.de-bekanntmachungen'] ['Energie','Mobilität','Wasserstoff','Solarenergie','regenerative','regenerativ','erneuerbar','Transport']§%§%nCqXY7riWQkZStD8Y \ No newline at end of file