Questions tagged [goquery]

A little like that j-thing, only in Go.

A little like that j-thing, only in Go. https://github.com/PuerkitoBio/goquery

76 questions
1
vote
0 answers

How to save the image in html (in crawler), which is changed to another image after about 1 minute or by reload(request)

I'm trying to make some automatic captcha input systems (recognition of figures in captcha image by deep learning and input the figure automatically) . For that, the captcha image should be inputted to some deep learning system. The captcha image in…
1
vote
0 answers

Use GoQuery to modify style?

In GoQuery, how do you use it properly to modify the style of a certain element in a loop? I am currently unable to find it in the documentation. doc.Find("class[id=needsclick]").Each(func(i int, s *goquery.Selection) { // not too sure what to put…
i7solar
  • 39
  • 5
1
vote
2 answers

How can I use goquery parse single element

aaaaaaaa bbbb.
ccccccdddddddd
I use this code to parse and get: doc, err :=…
1
vote
0 answers

Correlating HTML elements when scraping with golang/goquery/colly

I've been using colly for some simple web scraping tasks. It works fine for most of the cases where the web page layouts are consistent or for simple logic (e.g. a lot of existing examples and projects are "here's how you find the second table") I'm…
Fewmitz
  • 487
  • 1
  • 5
  • 21
1
vote
0 answers

How might I find an element in goquery like I would with find_all in BeautifulSoup?

I want to accomplish with goquery the same what is done by the following Python code (the xpath in the comment specifies what is my target): from requests import get from bs4 import…
John Smith
  • 835
  • 1
  • 7
  • 19
1
vote
0 answers

Colly (GoLang) Web Scrapper - 403 Forbidden

I am trying to scrape products from mediamarkt site with Colly. Here is my code: func WebScraper(allowedDomain string, page string, htmlElement string, htmlTag string) { /* Order in which Collector's callbacks are executed in: 1.…
Stefan Radonjic
  • 1,449
  • 4
  • 19
  • 38
1
vote
1 answer

How can I add a non-escaped string as a plaintext node or as an attribute value?

I am trying to use a string containing a ' character as an attribute value. However, ' is always replaced with '. Is there a way around this? Since the value is enclosed with ", ' wouldn't necessarily have to be escaped, would it? The same…
who'
  • 61
  • 2
1
vote
1 answer

goquery replace html element with ReplaceWithSelection has not affect

✌️ I am trying to replace an html parent element with its child elements using "github.com/PuerkitoBio/goquery". However, ReplaceWithSelection does not replace anything and the selection remains unchanged. package main import ( "os" …
who'
  • 61
  • 2
1
vote
1 answer

goquery BeforeHtml doesn't add element

I am trying to insert an html element before another html element using "github.com/PuerkitoBio/goquery". Unfortunately, the new element is not added package main import ( "os" "strings" "github.com/PuerkitoBio/goquery" ) var html =…
who'
  • 61
  • 2
1
vote
1 answer

Web crawler stops at first page

I'm working on a webcrawler which should be working like this: go to a website, crawl all links from the site download all images (starting from the startpage) if there are no images left on the current page, go to the next link found in step 1 and…
worrath
  • 55
  • 5
1
vote
0 answers

convert html text and nested tag to literal string with goquery

I am making web application which retrieves text within nested tag by scraping with goquery. I want to display text and tag which contains the text literally such as "<'h1'>Hello World!<'/h1'>" in text form. item - it is goquery.Selection -…
QuavoHuncho
  • 51
  • 2
  • 4
1
vote
1 answer

A little bit lost with goQuery selection

I'm new to Go and I'm trying to learn it by making a repost bot. Anyway, I'm having a problem that I don't know how to solve exactly. I have the following Struct: type Post struct { Title string Url string } And I'm trying to get these…
danibrum
  • 459
  • 8
  • 21
1
vote
1 answer

Golang - finding text for each child element separately with PuerkitoBio/goquery

I am new to Golang and just started learning it. I want to find some information from a site and extract the data that I need. I am using the PuerkitoBio/goquery package to select elements and read from them. I would like to extract the data from…
Leff
  • 1,968
  • 24
  • 97
  • 201
1
vote
1 answer

How to get DOM HTML in Go

I'm writing a parser HTML in Go. I need to get HTML and pass it to another function. I did it so: Can`t pass "doc" to another function receivedURL, err := http.Get("http://lavillitacafe.com/") doc, err :=…
1
vote
0 answers

panic: stream error: stream ID 1; PROTOCOL_ERROR

I am using goquery to get the DOM of a webpage. I tried looking into the godocs but I'm not sure why I get this error: All I'm trying to do here is fetching a webpage content in a url. snippet: response, err := http.Get(somedotcom) doc, err :=…