diff options
author | msglm <msglm@techchud.xyz> | 2023-02-17 03:11:26 -0600 |
---|---|---|
committer | msglm <msglm@techchud.xyz> | 2023-02-17 03:11:26 -0600 |
commit | e3d871381ffd4414f895ee2590bbb44e2fa04dde (patch) | |
tree | cefd31b3d390cdee82b3f924445e5b81b2f216ed /src | |
parent | b44190f82a942754beb07872740635b37b4ee7c2 (diff) | |
download | indeedwatcher-e3d871381ffd4414f895ee2590bbb44e2fa04dde.tar.gz indeedwatcher-e3d871381ffd4414f895ee2590bbb44e2fa04dde.tar.bz2 indeedwatcher-e3d871381ffd4414f895ee2590bbb44e2fa04dde.zip |
port preference is definable in config
Diffstat (limited to 'src')
-rw-r--r-- | src/indeedwatcher.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/indeedwatcher.nim b/src/indeedwatcher.nim index 9c280bb..0fc8af4 100644 --- a/src/indeedwatcher.nim +++ b/src/indeedwatcher.nim @@ -40,7 +40,7 @@ let config = parsetoml.parseFile(getConfigDir() & "/indeedwatcher/config.toml") ##Main section of config let feeds = config["feeds"].getElems().mapIt(it.getStr()) let outdir = config["outdir"].getStr() - +let driverURL = "http://localhost:" & config["port"].getInt().intToStr() ##Cache section of config let chromedriverloc = config["chromedriver"].getStr() let cachefileloc = getCacheDir() & "/indeedwatcher/listings.cache" @@ -52,16 +52,17 @@ let titleblacklist = config["blacklist"]["title"].getElems().mapIt(it.getStr()) ##Does the user desire headlessness? var args: JsonNode if config["headless"].getBool(): - args = %*{ "capabilities": {"alwaysMatch": { "goog:chromeOptions": { "args": ["--headless", "--lang=en_US", "--window-size=1920,1080", "--start-maximized", "--user-agent=\"Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/109.0\""], } } } } + args = %*{ "capabilities": {"alwaysMatch": { "goog:chromeOptions": { "args": ["headless", "lang=en_US", "window-size=1920,1080", "start-maximized", "user-agent=\"Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/109.0\""], } } } } + else: - args = %*{"capabilities": {"browserName": "chrome"}} + args = %*{ "capabilities": {"alwaysMatch": { "goog:chromeOptions": { "args": ["start-maximized"] } } } } #Webdriver let chromedriver = startProcess(chromedriverloc) sleep 5000 echo "connecting" #TODO make the port configurable, some users may have something running here -let driver = newWebDriver("http://localhost:9515") +let driver = newWebDriver(driverURL) var session: Session var feedcounter = 0 var urlcounter = 0 |