mirror of
https://github.com/PuerkitoBio/goquery.git
synced 2024-04-21 12:31:36 +00:00
add another method to get html document
This commit is contained in:
@@ -32,6 +32,14 @@ func NewDocument(url string) (d *Document, e error) {
|
||||
if e != nil {
|
||||
return
|
||||
}
|
||||
return NewDocumentWithHttpResponse(res)
|
||||
}
|
||||
|
||||
// NewDocumentWithHttpResponse() is another Document constructor that takes a http resonse as argument.
|
||||
// If you want to get some page which need be authorized,this method may be helpful
|
||||
// It loads the specified document, parses it, and stores the root Document
|
||||
// node, ready to be manipulated.
|
||||
func NewDocumentWithHttpResponse(res *http.Response) (d *Document, e error) {
|
||||
defer res.Body.Close()
|
||||
|
||||
// Parse the HTML into nodes
|
||||
|
||||
Reference in New Issue
Block a user