extractScripts function

List<ScriptContent> extractScripts(
  1. BeautifulSoup soup
)

Implementation

List<ScriptContent> extractScripts(BeautifulSoup soup) {
  List<Bs4Element> scripts = soup.findAll("script");
  List<ScriptContent> actualScripts = [];
  for (var script in scripts) {
    var src = script.getAttrValue("src");
    if (src != null && src.contains("type")) {
      actualScripts.add(ScriptContent(queriesFromSoup(src), src));
    }
  }
  return actualScripts;
}