-1
I am developing a software and among its features I would like to separate a specific part of a string
My code is like this so far
baseURL := "https://google.com/"
body, _ := ioutil.ReadAll(response.Body)
localizaScript := string(body)
fmt.Println(localizaScript)
response.Body.Close()
When I give fmt.Println(localizaScript)
, it returns me the huge HTML of the page in string format, I would like to get only the tag
<script type="text/javascript" src="https://static.kabum.com.br/datadome.js"></script>
and separate into another variable string.
What is the criterion for achieving this separation? Edit your question to better explain the algorithm you want to do. It would also be more ideal to try to provide a code that you have already tried to do. :-)
– Luiz Felipe
Okay, I think you’re better now heheh
– Lucas Coacci
Have you ever thought about using a library that parses HTML? An example is
goquery
. I believe it is the best alternative, because regular expressions are not ideas for Parsing html.– Luiz Felipe
I’ll read about :) Thanks
– Lucas Coacci