因此,基本上,我正在尝试使用Dart和Flutter来自学移动开发,目前,我正在尝试将移动应用连接到网站并获取H1标签的文本,并暂时将其显示在控制台中。另外,H1标签正在通过Javascript加载。有什么办法吗?
如果我没错,这是您的答案:
进一步浏览塞思的评论,您应该可以为此使用html库。应该看起来像这样:导入'package:html / parser.dart'显示解析;导入“ package:html / dom.dart”;
var document = parse(response.body);
var priceElement = document.getElementsByClassName("product_price_from");
// priceElement may have weird formatting (I see ) so you might need to do some parsing
// here to solve that
有关更多信息,请查看here