summaryrefslogtreecommitdiffstats
path: root/src/indeedwatcher.nim
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-11 20:49:25 -0600
committermsglm <msglm@techchud.xyz>2023-01-11 20:49:25 -0600
commit07e77fb6dc8a5ab9472db86f269c3a844199add1 (patch)
tree28ceb94f6fd44839d618d858b8e5ad48af266492 /src/indeedwatcher.nim
parent5c11fb28d3f042d4888d2d5ea2952c8d651e8391 (diff)
downloadindeedwatcher-07e77fb6dc8a5ab9472db86f269c3a844199add1.tar.gz
indeedwatcher-07e77fb6dc8a5ab9472db86f269c3a844199add1.tar.bz2
indeedwatcher-07e77fb6dc8a5ab9472db86f269c3a844199add1.zip
latex stuff added; probably going to remove
Diffstat (limited to 'src/indeedwatcher.nim')
-rw-r--r--src/indeedwatcher.nim80
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")