python爬取时未检索到代理站点端口号

问题描述 投票:0回答:0

我在使用 Python 进行网络抓取时无法从代理站点获取端口号。 在下面的 HTML 代码结构中,当我使用 Beautiful Soup 选择 IP 地址时,如下所示:

ip = soup.select('tr > td:first-of-type > .spy14')

并打印 ip.text,仅返回第一个值“125.141.151.83”。

我还想检索“:80”之后的第二个值。 但是,当我尝试调试代码时,由于中间存在脚本标记,无法读取“:80”的值。我怎样才能检索到这个值?

enter image description here

我已尝试调试和检查与“ip”值相关的所有变量,但找不到“:80”字符串。

python beautifulsoup web-crawler
© www.soinside.com 2019 - 2024. All rights reserved.