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
8
votes
2 answers

how to get value of attribute href value in Go language

I want to parse anchor link from the html content. /* My HTML Content Sample */
Naresh
  • 2,761
  • 10
  • 45
  • 78
7
votes
1 answer

Use goquery to find a class whose value contains whitespace

Answered. User PuerkitoBio helped me out with his goquery package, and I'm sure I won't be the only one wondering how to do this. (I can mark this question as 'answered' in two days) When using goquery to find classes of html tags, I hit a problem…
GreenRaccoon23
  • 3,603
  • 7
  • 32
  • 46
4
votes
2 answers

How to break out goquery Each loop in Go

Could you help me break out a loop of goquery Each looping? I used "return" but it doesn't get out of loop, just pass the iteraction... How can I break out an Each looping in the following code: doc.Find("td").Each(func(i int, s *goquery.Selection)…
Paulo Farah
  • 323
  • 2
  • 11
4
votes
3 answers

How to convert HTML table to array with golang

I'm having a problem trying to convert an HTML table into a Golang array. I've tried to achieve it using x/net/html and goquery, without any success on both of them. Let's say we have this HTML table: …
Paniko0
  • 528
  • 5
  • 11
4
votes
2 answers

Extract meta description field with goquery

I'm using the goquery package to extract pieces of information from a webpage. Please see my code below. The outcome when after running the function is: Description field: text/html; charset=iso-8859-15 Description field:…
Rogier Lommers
  • 2,263
  • 3
  • 24
  • 38
3
votes
1 answer

How to get response after http request

I'm studying Go and am a real newbie in this field. I am facing a problem when I try to copy some value. What I am doing is: I want to get some response in [response] using httpRequest. httpClient := &http.Client{} response, err :=…
JungHoon
  • 302
  • 1
  • 4
  • 17
2
votes
0 answers

join using Goqu and scan the results into a struct containing an array of another struct

type selectUserWithOrders struct { id int name string orders []order } type order struct { id int total int } // user table columns are -> id , name, password // orders table columns are -> id, user_id(fk), order_value func (r *Repository)…
raj.dev
  • 21
  • 3
2
votes
1 answer

Extracting information from an attribute using goquery

package main import ( "fmt" "github.com/PuerkitoBio/goquery" "net/http" ) func main() { url := "https://books.toscrape.com" resp, err := http.Get(url) if err != nil { fmt.Println(err) } defer…
Woody
  • 21
  • 2
2
votes
2 answers

Golang table webscraping

I have a code as below to scrape the specific cell value from html table. You can go to https://www.haremaltin.com/altin-fiyatlari website and search "satis__ATA_ESKI" on inspect mode to see that value. I am beginner on golang and did my best but…
eyup.tatar
  • 75
  • 8
2
votes
2 answers

goquery filter doesn't return expected result

magical internet, I am trying to filter elements from an html string using "github.com/PuerkitoBio/goquery". Unfortunately, the filter function does not return the expected result. I would have expected to get back a list of all articles but…
who'
  • 61
  • 2
2
votes
0 answers

How to scrape an unordered list with go-colly?

I am trying to build a personal scraper of food recipes. I am able to get all other elements but food ingredients that are in unordered list. Here is a snippet of the page html: pagehtml My code so far that doesn't find strong element but prints…
M2R10
  • 23
  • 5
2
votes
1 answer

Waiting for all goroutines to finish and combining the results

I have some hard times understanding goroutines, channels and all sync thing. I believe I understand the concepts, but I'm missing a couple of lines to connect all the information I have. Also, the majority of the examples feel too simple, so I…
cojoj
  • 6,405
  • 4
  • 30
  • 52
2
votes
0 answers

How to find an element inside a Node

I am trying to get data with goquery from an HTML document. The HTML is structured like this:
Leff
  • 1,968
  • 24
  • 97
  • 201
2
votes
1 answer

How can I get the type name of DOM using goquery?

I want to get the type name of DOM like 'a', img', 'tr', 'td', 'center' using goquery. How can I get? package main import ( "github.com/PuerkitoBio/goquery" ) func main() { doc, _ := goquery.NewDocument("https://news.ycombinator.com/") …
Maiko Ohkawa
  • 853
  • 2
  • 11
  • 28
2
votes
1 answer

goquery- Concatenate a tag with the one that follows

For some background info, I'm new to Go (3 or 4 days), but I'm starting to get more comfortable with it. I'm trying to use goquery to parse a webpage. (Eventually I want to put some of the data in a database). For my problem, an example will be the…
GreenRaccoon23
  • 3,603
  • 7
  • 32
  • 46
1
2 3 4 5 6