Python爬取原网页没有的数据

https://www.discoverisc.com/west/en-us/show-info/exhibitor-list.html#/这个网页如何通过网页源码获取右方参会公司的页面网址

只要你能点进去,就能获取到

【以下回答由 GPT 生成】

我可以帮你解决这个问题。要通过网页源码获取右侧参会公司的页面网址,你可以使用Python中的爬虫库来实现。下面是一个具体的解决方案:

  1. 使用requests库向给定的网址发送GET请求,获取网页源码。代码如下:
import requests

url = "https://www.discoverisc.com/west/en-us/show-info/exhibitor-list.html#/"
response = requests.get(url)
html = response.text
  1. 使用BeautifulSoup库解析网页源码,并找到所有包含参会公司网址的 HTML 元素。可以通过审查网页源码找到这些元素的特征,比如class、id等。代码如下:
from bs4 import BeautifulSoup

soup = BeautifulSoup(html, "html.parser")
company_links = soup.find_all(class_="company-link")
  1. 遍历company_links,提取每个参会公司的页面网址。代码如下:
company_urls = []
for link in company_links:
    company_url = link["href"]
    company_urls.append(company_url)
  1. 最后,你可以打印出获取到的所有参会公司的页面网址,或者进行进一步的处理。

完整的代码如下:

import requests
from bs4 import BeautifulSoup

url = "https://www.discoverisc.com/west/en-us/show-info/exhibitor-list.html#/"
response = requests.get(url)
html = response.text

soup = BeautifulSoup(html, "html.parser")
company_links = soup.find_all(class_="company-link")

company_urls = []
for link in company_links:
    company_url = link["href"]
    company_urls.append(company_url)

print(company_urls)

请注意,这只是一个简单的示例来获取参会公司的页面网址。具体的解决方案可能因网页结构而异,你可能需要根据实际情况做一些调整和适应。

希望这个解决方案对你有帮助!如果你有任何疑问,请随时提问。


如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^

这个网站的数据直接用requests 是获取不到的,查看了之后,发现是在接口中通过post传输的,但是可能也进行了加密,直接进行接口请求,显示403.
所以,用selinum来进行爬取是比较靠谱的,我也验证过了。
你可以试一下,有需要可以随时联系。

img