python-3.x 有没有一种方法可以通过其类名称的开头找到div?[关闭]

68bkxrlz  于 4个月前  发布在  Python
关注(0)|答案(1)|浏览(74)

**已关闭。**此问题需要debugging details。目前不接受回答。

编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答问题。
3天前关闭。
这篇文章是编辑并提交审查3天前.
Improve this question
我需要用python 3.12抓取一些网站的特定数据,我在网站上发现了这个:<div class="x1qjc9v5 something something">,我需要抓取它下面的日期。唯一匹配的是x1qjc9v5,我需要一个方法来搜索它。
这是我的代码,它没有给我下面的html块。它的网站是instagram.com/apple/。

from bs4 import BeatifulSoup
import requests

response = requests.get("instagram.com/apple")
soup = BeautifulSoup(response.content.decode("utf-8"), 'html.parser')
paragraphs = soup.find_all('div', attrs={'class':'x1qjc9v5'})

字符串

ecbunoof

ecbunoof1#

取决于你要怎么处理约会
你可以用JavaScript选择它

document.querySelectorAll('[class^="x1qjc9v5"]')

字符串
这是您要找的吗?

相关问题