GoQuery open stack of elements exceeds 512 nodes when reading an img page

1 week ago 10
ARTICLE AD BOX

I'm currently building a web crawler for a search engine, and I am encountering an error when it comes to processing pages ending in `.png`.

My crawler is written in go, and I am using goquery.

Below is a script which reproduces the error I'm getting:

package main import ( "net/http" "github.com/PuerkitoBio/goquery" ) func main() { url := "https://nicolasgatien.com/images/root-game.png" resp, err := http.Get(url) if err != nil { panic(err) } defer resp.Body.Close() println(url) doc, err := goquery.NewDocumentFromReader(resp.Body) if err != nil { panic(err) } println(doc.Text()) }

The URL links to a page from my website with an image. When goquery attempts to create a new document from the response body, I get the following error:

html: open stack of elements exceeds 512 nodes

I'm not entirely sure where to go from here, because the page it is processing only has a few nodes.

How is it exceeding the limit?

Nicolas Gatien's user avatar

1

Read Entire Article