How to use css selector in Golang

219 views Asked by At

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: Here is the HTTP I'm trying to parse through:

<img src="/icons/folder.gif" alt="[DIR]"> <a href="convobot-main/">convobot-main/</a>                    2022-01-27 13:55    -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="matlab/">matlab/</a>                           2022-01-31 11:58    -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="test/">test/</a>                             2022-01-27 13:52    -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="test3%20-%20Copy/">test3 - Copy/</a>                     2022-02-09 15:09    -
<img src="/icons/folder.gif" alt="[DIR]"> <a href="test3/">test3/</a>                            2022-02-09 10:47    -
<img src="/icons/unknown.gif" alt="[   ]"> <a href="Quadractic.mlx">Quadractic.mlx</a>                    2022-01-21 15:02  3.3K
</pre>

I am looking to get the file names like Quadractic.mlx

0

There are 0 answers