From 466e5376d61f004169fce19c8e20d192d272b59e Mon Sep 17 00:00:00 2001 From: msglm Date: Wed, 11 Jan 2023 20:49:27 -0600 Subject: oops forgot arrays indexed at 0 for a moment --- src/indeedwatcher.nim | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/indeedwatcher.nim b/src/indeedwatcher.nim index 2e5ff87..0f86a18 100644 --- a/src/indeedwatcher.nim +++ b/src/indeedwatcher.nim @@ -18,7 +18,7 @@ let cachefileloc = getCacheDir() & "/indeedwatcher/listings.cache" var cache = splitLines(readFile(cachefileloc)) #Webdriver -let chromedriver = startProcess(chromedriverloc, "", ["--headless", "--disable-gpu"]) +let chromedriver = startProcess(chromedriverloc, "", ["--headless"]) sleep 5000 echo "connecting" #TODO make the port configurable, some users may have something running here @@ -39,42 +39,45 @@ proc terminate() {.noconv.} = setControlCHook(terminate) for feed in feeds: - echo "now reading " & feed - #Feednim + #Getting the listing URLs from the feeds + echo "now reading " & feed + sleep 1000 var rssFeedReply = getRSS(feed) for entry in rssFeedReply.items: - echo entry.link - #Logging - + #Sleep so indeed.com doesn't freak out if counter > 7: echo "resting for 7 seconds ..." sleep 7000 counter = 0 + + #Don't even bother visiting it if its in the cache var URL = entry.link - let URLID = entry.link.split('&')[4] + let URLID = entry.link.split('&')[3] + echo URL + echo URLID echo any(cache, proc (input: string): bool = input.contains(URLID)) if not any(cache, proc (input: string): bool = input.contains(URLID)): session.navigate(URL) counter = counter + 1 #HTML Parser - var salaryInfoAndJobType: string - var employer: string let jobTitle = session.findElement(".jobsearch-JobInfoHeader-title").get().getText() + let fullDesc = session.findElement("#jobDescriptionText").get().getText() + var employer: string try: employer = session.findElement(".jobsearch-InlineCompanyRating-companyHeader").get().getText() except UnpackDefect: - salaryInfoAndJobType = "None Listed" + employer = "None Listed" + var salaryInfoAndJobType: string try: salaryInfoAndJobType = session.findelement("#salaryInfoAndJobType").get().gettext() except UnpackDefect: salaryInfoAndJobType = "None Listed" - let fullDesc = session.findElement("#jobDescriptionText").get().getText() #Job Value Scorer -- cgit v1.2.3