From 07e77fb6dc8a5ab9472db86f269c3a844199add1 Mon Sep 17 00:00:00 2001 From: msglm Date: Wed, 11 Jan 2023 20:49:25 -0600 Subject: latex stuff added; probably going to remove --- src/indeedwatcher | Bin 797072 -> 0 bytes src/indeedwatcher.nim | 80 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 72 insertions(+), 8 deletions(-) delete mode 100755 src/indeedwatcher (limited to 'src') diff --git a/src/indeedwatcher b/src/indeedwatcher deleted file mode 100755 index 6c19c76..0000000 Binary files a/src/indeedwatcher and /dev/null differ diff --git a/src/indeedwatcher.nim b/src/indeedwatcher.nim index 0c7e8a4..1807e93 100644 --- a/src/indeedwatcher.nim +++ b/src/indeedwatcher.nim @@ -1,22 +1,86 @@ import rss import webdriver import osproc -import threadpool import options +import os +import strutils +#Feednim var test = getRSS("https://rss.indeed.com/rss?q=Linux&l=Arkansas&explvl=mid_level") -echo test.items[0].link +var URL = test.items[5].link +#Webdriver #TODO put location of chromedriver into config let chromedriver = startProcess("/usr/bin/chromedriver") +sleep 5000 +echo "connecting" let driver = newWebDriver("http://localhost:9515") let session = driver.createSession() +session.navigate(URL) -session.navigate(test.items[0].link) -echo session.findElement(".jobsearch-DesktopStickyContainer").get().getText() -echo session.findElement(".jobsearch-JobDescriptionSection-sectionItem").get().getText() -echo session.findElement("#salaryGuide").get().getText() -echo session.findElement("#jobDescriptionText").get().getText() -echo session.findElement("#jobDescriptionText").get().getText() +#HTML Parser +var jobTimes: string +var salaryGuide: string + +let jobTitle = session.findElement(".jobsearch-JobInfoHeader-title").get().getText() +let employer = session.findElement(".jobsearch-CompanyReview--heading").get().getText() + +try: + jobTimes = session.findElement(".jobsearch-JobDescriptionSection-sectionItem").get().getText() +except UnpackDefect: + jobTimes = "" + +try: + salaryGuide = session.findelement("#salaryGuide").get().gettext() +except UnpackDefect: + salaryGuide = "None Listed" + +if salaryGuide.contains("Not provided by employer"): + salaryGuide = "None Listed" + +let fullDesc = session.findElement("#jobDescriptionText").get().getText() +session.close() terminate(chromedriver) +#Job Value Scorer + +#Parsing Salary + +#Output +var output = """ +\documentclass{article} +\usepackage[margin=0.7in]{geometry} +\usepackage{pdfpages} +\usepackage{hyperref} +\hypersetup{ + colorlinks=true, + linkcolor=black, + filecolor=magenta, + urlcolor=blue, + } + + +\begin{document} + +\begin{center} + \Huge{$1} +\end{center} +\hrulefill + + \large{$2} + \hspace{3cm} + \large{$3} + \hspace{3cm} + \large{\href{$4}{URL}} + \hspace{3cm} + \large{$5} + +\hrulefill + +$6 + +\end{document} +""" % [jobTitle, employer, salaryGuide, URL.replace("&","\\&"), jobTimes, fullDesc.replace("#", "\\#").replace("&", "\\&").replace("\"", "\\\"").replace("'","\\'")] + +writeFile("/tmp/test.tex", output) +discard execCmd( "latexmk -pdf -pvc /tmp/test.tex") -- cgit v1.2.3