mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 20:26:58 +00:00
lantern.py option 1: when adding a new website, delete existing same urls ones
Fix issue #43
This commit is contained in:
parent
8048a52770
commit
c7074e4428
1 changed files with 22 additions and 2 deletions
|
@ -229,8 +229,28 @@ Maintenance:
|
|||
newrow=[instance,category,name,url,sensi,desc,'YES','100']
|
||||
print_colors(f"[+] NEWROW= {newrow}")
|
||||
# (rest is automatic: status, score, instance is = '' because it is your own instance)
|
||||
# TODO check if the entry doesnt already exist in verified.csv and in unverified.csv
|
||||
# if it doesnt exist, add it into unverified.csv
|
||||
# delete existing entries in verified.csv
|
||||
vdf_same_url_filter = vdf["URL"] == url # check for same url
|
||||
vdf_same_url_filter_count = vdf_same_url_filter.sum() # total url matches
|
||||
if vdf_same_url_filter_count > 0:
|
||||
print(f"Found {vdf_same_url_filter_count} row(s) with the same url in verified.csv")
|
||||
for index, row in vdf[vdf_same_url_filter].iterrows():
|
||||
print_colors(f"[+] ROW[{index}]= {list(row)}")
|
||||
vdf = vdf[~vdf_same_url_filter].reset_index(drop=True) # keep only entries that do not match filter
|
||||
print(f"Deleted {vdf_same_url_filter_count} row(s) with the same url in verified.csv")
|
||||
if desc == '': # if the description is empty = it means that it goes in unverified.csv, so save modified verified.csv file now
|
||||
vdf.to_csv(verifiedcsvfile, index=False)
|
||||
# delete existing entries in unverified.csv
|
||||
uvdf_same_url_filter = uvdf["URL"] == url # check for same url
|
||||
uvdf_same_url_filter_count = uvdf_same_url_filter.sum() # total url matches
|
||||
if uvdf_same_url_filter_count > 0:
|
||||
print(f"Found {uvdf_same_url_filter_count} row(s) with the same url in unverified.csv")
|
||||
for index, row in uvdf[uvdf_same_url_filter].iterrows():
|
||||
print_colors(f"[+] ROW[{index}]= {list(row)}")
|
||||
uvdf = uvdf[~uvdf_same_url_filter].reset_index(drop=True) # keep only entries that do not match filter
|
||||
print(f"Deleted {uvdf_same_url_filter_count} row(s) with the same url in unverified.csv")
|
||||
if desc != '': # if the description isnt empty = it means that it goes in verified.csv, so save modified unverified.csv file now
|
||||
uvdf.to_csv(unverifiedcsvfile, index=False)
|
||||
if desc == '': # if the description is empty = it means that it goes in unverified.csv
|
||||
print("Adding new row in unverified.csv since description is empty")
|
||||
uvdf.loc[-1] = newrow # adding a row
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue