【发布时间】:2019-01-08 20:48:23
【问题描述】:
我在 stackoverflow 中的第一个问题。我是python的初学者,我想请求任何喜欢的Instagram照片,但我的代码返回空
import requests
from bs4 import BeautifulSoup
url = "https://www.instagram.com/p/BsYt_megGfN/"
r = requests.get(url)
soup = BeautifulSoup(r.content,"html.parser")
data = soup.findAll("div",{"class","Nm9Fw"})
print(data)
我想查看喜欢这张照片但我不喜欢的人的名字。
【问题讨论】:
-
空列表意味着
soup.findAll在提取的html内容中没有找到任何div和class。 -
beautifulsoup 的 html 解析器无法解析 javascript。
标签: python web-scraping beautifulsoup python-requests