WebScraping findAll()无法获取所有内容

2024-09-29 06:26:06 发布

您现在位置:Python中文网/ 问答频道 /正文

the image shows the area that i want to access

此图显示了我要访问的区域

containers = pagebs('div',{'class':"search-content"})

当我打印容器时,它只是显示

[<div class="search-content">
</div>]

里面什么都没有。我试着在里面搜索不起作用的标签 是否有解决方法,或者无论我做什么,我都无法访问它

这就是我到目前为止写的

from bs4 import BeautifulSoup as BS
from urllib.request import urlopen as uReq
url = 'https://bahrain.sharafdg.com/?q=asus%20laptops&post_type=product'
uclient = uReq(url)
pagehtml = uclient.read() 
uclient.close()
pagebs = BS(pagehtml , 'html.parser')
containers = pagebs('div',{'class':"search-content"})
 

Tags: fromimportdiv区域urlsearchbsas