gpt4 book ai didi

javascript - jQuery:搜索已在 HTML 中注释掉的数据

转载 作者:行者123 更新时间:2023-12-03 03:32:52 25 4
gpt4 key购买 nike

我正在尝试访问试图阻止抓取工具的页面上的一些数据。

根据我收集的信息,该页面的行为如下:

1.) 骨架页面加载2.) 一旦完成,就会有一些 JavaScript 访问数据 blob,然后用适当的内容填充页面

我尝试访问的数据如下所示

<code id="templates/desktop/profile/profile_streaming..."><!--{"data":{"breadcrumbs": ...this is where the data is... }}--></code>

以及运行的脚本:

<script>if (!fs.isUniEscapeOn()) { fs.setUniEscape(true); }fs.embed('templates/desktop/profile/profile_streaming...','templates/desktop/profile/profile_streaming',undefined,'stream-container');</script>

但是,当我尝试像 $('code') 这样的 jQuery 选择器时或$('code[id*="templates]')他们都找不到该元素。

页面是否可以从 jQuery 选择器中隐藏元素?

有关如何访问 <code > 内的数据的任何想法标签?

enter image description here

最佳答案

如果<code> </code>的内容只是评论,

$('code').contents()[0].data 

将从那里提取评论。如果内容有 JSON 可以使用 JSON.parse从由此获得的对象中获取您感兴趣的领域。

关于javascript - jQuery:搜索已在 HTML 中注释掉的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46006448/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com