go - Golang web scraper NTLM authentication -
a golang web scraper needs extract information webpage ntlm-authenticated.
having valid username & password, how can web scraper perform ntlm 4-way handshake server in order gain access protected webpage behind?
url, username, password := "http://www.some-website.com", "admin", "12345" client := &http.client{} req, _ := http.newrequest("get", url, nil) req.header.set("authorization", "ntlm") res, _ := client.do(req)
you can use package azure/go-ntlmssp
authenticate before start scraping.
url, username, password := "http://www.some-website.com", "admin", "12345" client := &http.client{ transport: ntlmssp.negotiator{ roundtripper:&http.transport{}, }, } req, _ := http.newrequest("get", url, nil) req.setbasicauth(username, password) res, _ := client.do(req)
Comments
Post a Comment