I'm very new to Nim.
I want to capture the web pages. However I can't find modules...
Is it possible to capture the pages with Nim?
Thank you!
Your best best is Selenium, not sure if there are Nim bindings but @dom96's Webdriver can be a good start.
Otherwise if you only want to scrape webpages there are several examples you can find on Google:
@mratsim Thank you for your answer! That's the first time I heard Webdriver! Thank you!
However, when I execute bellow code, it occurs errors:
[Code]
import webdriver
var driver = newWebDriver("http://example.com")
var session = createSession(driver)
[Errors]
Hint: operation successful (53276 lines compiled; 2.465 sec total; 92.52MiB peakmem; Debug Build) [SuccessX]
Hint: C:\project\nim\web_capture.exe [Exec]
web_capture.nim(5) web_capture
webdriver.nim(44) createSession
httpclient.nim(1248) getContent
Error: unhandled exception: 404 Not Found [HttpRequestError]
Error: execution of an external program failed: 'C:\project\nim\web_capture.exe '
And if access https, it occurs another error:
[Code]
import webdriver
var driver = newWebDriver("https://nnahito.com/") # This is my blog site.
var session = createSession(driver)
[Error]
Hint: operation successful (54457 lines compiled; 1.527 sec total; 92.547MiB peakmem; Debug Build) [SuccessX]
Hint: C:\project\nim\web_capture.exe [Exec]
web_capture.nim(5) web_capture
webdriver.nim(45) createSession
json.nim(828) parseJson
json.nim(820) parseJson
json.nim(809) parseJson
parsejson.nim(531) raiseParseErr
Error: unhandled exception: input(1, 1) Error: { expected [JsonParsingError]
Error: execution of an external program failed: 'C:\project\nim\web_capture.exe '
It succeeded to compile both program. However failed to execute both program.
Why the error occurred?
@juancarlospaco Thank you for your answer!
Is it possible to execute on Windows? I think maybe can't....