antchfx / htmlquery

htmlquery is golang XPath package for HTML query.
https://github.com/antchfx/xpath
MIT License
738 stars 74 forks source link

i can,t parse scripts from document , using xpath query #68

Closed Crypt00o closed 1 year ago

Crypt00o commented 1 year ago

i can,t parse scripts from document , using xpath query for example :

document:

<html>
           <head>
                <script src="https://example.com/example1.js"></script>
            </head>
            <body>
                 <script src="https://example.com/example2.js"></script>
             </body>
</html>

nodes,_:=html.QueryAll(doc,"//script[@src]")
fmt.Println(nodes)   // will ouput [] empty *html.Node slice
zhengchun commented 1 year ago

it's weird. It works on my local test. What is your version of htmlquery, xpath.

Crypt00o commented 1 year ago

I'm sorry for the confusion. I've just realized that the issue was internal to my code. When I tested the package itself, it works perfectly and extract scripts . I appreciate your response and support!, Thanks !<3