【问题标题】:Is there any way to extract dataLayer information from a webpage with python?有没有办法用python从网页中提取dataLayer信息?
【发布时间】:2022-07-18 17:05:21
【问题描述】:

我正在构建数据集,使用 dataLayer 变量(对象)信息。 我想通过机器学习自动化页面分类过程。 enter image description here

【问题讨论】:

    标签: python database machine-learning deep-learning data-layers


    【解决方案1】:

    是的,有。

    • 如果变量是静态分配的,例如<script> 块,然后您可以使用例如解析 HTML Beautiful Soup,找到脚本块并得到结果。
    • 不过,更有可能的是,数据是在页面加载后动态生成的,因此您需要例如Playwright 自动化无头浏览器,然后从那里读取变量。

    【讨论】:

      猜你喜欢
      • 2020-12-31
      • 2021-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多