antchfx / htmlquery

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

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

Closed Crypt00o closed 10 months ago

Crypt00o commented 10 months 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 10 months ago

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

Crypt00o commented 10 months 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