diff options
Diffstat (limited to 'src/indeedwatcher.nim')
-rw-r--r-- | src/indeedwatcher.nim | 80 |
1 files changed, 72 insertions, 8 deletions
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") |