spider is posting to rooms based on tags now
This commit is contained in:
parent
320e19875a
commit
92c8b3a6f7
2 changed files with 24 additions and 3 deletions
|
@ -99,11 +99,12 @@ if __name__ == '__main__':
|
|||
for room in room_list:
|
||||
print(room[0])
|
||||
room_fdbs = room[2]
|
||||
room_tags = room[3]
|
||||
#subprocess.run(["python", spider_directory + 'main.py', fdbs])
|
||||
|
||||
for room_fdb in eval(room_fdbs):
|
||||
#print('room_fdb',room_fdb, 'fdb_list',fdb_list)
|
||||
if room_fdb in fdb_list:
|
||||
if room_fdb in fdb_list and room_fdb not in [key for key in data]:
|
||||
try:
|
||||
iteration_var_list = config.get(room_fdb).get("entry-list").get("iteration-var-list")
|
||||
except Exception as e:
|
||||
|
@ -119,11 +120,31 @@ 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:
|
||||
|
||||
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"]
|
||||
|
||||
api.send_message(entry_message, room[0])
|
||||
|
||||
|
||||
|
||||
|
||||
print('data',data['giz'][2],'data')
|
||||
|
||||
#print('data',data['giz'][2],'data')
|
||||
already_updated = True
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
printfdbs§%§%GGDZAhgELP2HDS5eM
|
||||
printfdbs§%§%cm9qFkkcbXdKuzXmC
|
Loading…
Reference in a new issue