我现在正在研究网络爬虫,似乎我无法从某个特定的网站上获得div中的类。下面是我的代码。我在Python3中使用了美容组
import requests
from bs4 import BeautifulSoup as bs
response = requests.get('https://e27.co/startup/flipkart').text
soup = bs(response, 'html.parser')
content_div = soup.findAll('h1',class_ = 'profile-startup')
print(content_div)
我想提取h1中的文本,该文本具有类“profile start”。以上代码不返回任何内容。你们能帮我吗?
这个网站正在使用Javascript填充数据。如果您查看
response
中的内容,您将看到没有h1
。您必须查看他们是否有一个API,您可以使用它来检索所需的信息,或者考虑使用像Selenium这样的浏览器自动化技术:http://selenium-python.readthedocs.io/installation.html#introduction相关问题 更多 >
编程相关推荐