From 67d89ff9eba6387b52bac960a304fd78e1fc5b35 Mon Sep 17 00:00:00 2001 From: oliver Date: Mon, 26 Aug 2024 00:55:36 -0600 Subject: [PATCH] it helps when you don't reference [0] for two separate elements... --- crawl.sh | 2 +- driver.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crawl.sh b/crawl.sh index 1fd437a..925b999 100755 --- a/crawl.sh +++ b/crawl.sh @@ -1,2 +1,2 @@ #!/bin/bash -cargo run -- https://discord.com 5 | python3 driver.py +cargo run -- $1 1000 | python3 driver.py diff --git a/driver.py b/driver.py index d0f49e2..a47da39 100644 --- a/driver.py +++ b/driver.py @@ -14,13 +14,15 @@ async def main(): # for line in ["https://oliveratkinson.net;->;http://google.com"]: urls = line.split(";->;") - ffrom = urls[0] - to= urls[0] + ffrom = urls[0].strip() + to= urls[1].strip() to_id = None from_id = None - print(ffrom, "->", to) + if (ffrom == to): + print('Site has self-reference, ignoring') + continue # FROM result = await db.query(f"SELECT id FROM website WHERE url='{ffrom}'")