I was using goquery to parse HTML and I need to retrieve the height of these HTML elements but goquery doesn't have a jquery like .css() method? How can I achieve something like this?
Is there any possibility to retrieve document doctype with goquery?
I've tried several things, but any worked. I suppose that it is possible, because NodeName func has switch with "html.DoctypeNode" case.
That code didn't find…
I'm new to Go and am trying to take advantage of the concurrency in Go to build a basic scraper to pull extract title, meta description, and meta keywords from URLs.
I am able to print out the results to terminal with the concurrency but can't…
In jQuery and CSS, you can use the > character which points to only the direct child element.
This works in Goquery with something like doc.Find("body > ul"), but when you already have a *goquery.Selection and you want to select a direct child…
The question sounds weird but I didn't know any better way to put it. I am using goquery and I am inside a switch-case:
switch{
case url == url1:
doc.Find("xyz").Each(func(i int,s *goquery.Selection){
a,_ := s.Attr("href")
…
Goquery Syntax-wise, it is as close as possible to jQuery, with the same function names when possible, and that warm and fuzzy chainable interface.
doc.Find("meta[property='og:image']").Each(func(i int, s *goquery.Selection) {
fmt.Fprintln("og…
I would like to retrieve all the tags with a specific id using Go. Apparently the easiest way to do that is go is to use goquery.
Assume I am looking for ul tags with id MyTag in a website site. I would like to list all the li contained in such a…
I'm trying to get the .mp4 video source of a vine, using GoQuery. However when I run it, I get nothing, no error, or return. Just a blank line.
package main
import (
"fmt"
"log"
"github.com/PuerkitoBio/goquery"
)
func getMP4URL() {
doc,…
I have the following function,
func getMosWantedInfo(doc *goquery.Document) {
doc.Find("div.flex-align-center.bg-base-lightest.padding-1.margin-1").Each(func(i int, s *goquery.Selection) {
// For each item found, get the title
…
In Ruby, I have something like contents = html_doc.css("img + a"). How would I do this in Go?
I am trying to use Goquery but I am unsure of how to convert it. Specifically, I tried doc.find("img") but it doesn't find anything for some reason
Edit:…