python | Web刮擦:HTML代码大多使用同一类时使用Web刮擦的问题,而没有任何ID或名称属性

发布于 2025-02-11 06:21:46 字数 471 浏览 1 评论 0原文

因此,我试图使用网络刮擦的页面是私人的。它使用双向身份验证,这不会让我通过硒打开链接。当我手动打开页面时,我不要求额外的身份验证。

该页面是自我使用页面上所有表的同一类,而TD标签中的类也大致相同。

这是带有数据的表,我不会提取

这是同一页面上的另一个表,我不需要,但是大多数都具有相同的类和标签

它确实杀死了我认为没有其他属性或任何内容可以使其更简单。由于事实并非如此,所以我真的很无知如何继续获取数据。

真正开放任何想法。 提前提前

so the page I'm trying to use Web Scraping on is Private. It uses two-way authentication, which will not let me open the link through selenium. When I open the page manually I'm not asked for extra authentication.

The Page is self uses the same classes for all the tables on the page and the classes in the td tag are all mostly the same as well.

Here is the Table with the data I wan't to extract

Here is another Table on the same Page, which I don't need, but mostly has the same classes and tags

It really kills me that no other attributes or anything was added in order to make this a bit more simple. Since that is no the case, I'm really clueless how to continue to get the data.

Really open for any ideas.
Thx in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

睫毛溺水了 2025-02-18 06:21:46

首先,如果数据始终处于相同的顺序中,则可以尝试使用CSS选择器,例如driver.find_element(by.css_selector,“ tr> td:nth-​​child(3)”)在第一个TR中获取第三个TD。

如果它不起作用,并且您的目标是获取与表中的密钥相关的信息,则可以制作一个循环以将表从表中收集到字典中,然后调用所需的键。

First, if the data are always in the same order, you can try to use a css selector, like driver.find_element(By.CSS_SELECTOR, "tr > td:nth-child(3)") to get the third td in the first tr for exemple.

If it don't work, and your goal is to get information related to a key in the table, you can make a loop to collect all the data from the table into a dictionnary, and then call the key that you want.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文