Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:website';s类打印出一个空列表_Python_Class_Web Scraping_Beautifulsoup_Empty List - Fatal编程技术网

Python:website';s类打印出一个空列表

Python:website';s类打印出一个空列表,python,class,web-scraping,beautifulsoup,empty-list,Python,Class,Web Scraping,Beautifulsoup,Empty List,我正在尝试使用以下脚本刮取类“stats”(物品价格和价格变化)中的所有内容: from urllib.request import urlopen as uReq from bs4 import BeautifulSoup as soup url = "https://secure.runescape.com/m=itemdb_oldschool/Dragon+warhammer/viewitem?obj=13576" uClient = uReq(url) page

我正在尝试使用以下脚本刮取类“stats”(物品价格和价格变化)中的所有内容:

from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup

url = "https://secure.runescape.com/m=itemdb_oldschool/Dragon+warhammer/viewitem?obj=13576" 

uClient = uReq(url)
page_html = uClient.read()

page_soup = soup(page_html, "html.parser")

price = page_soup.find_all(class_ = "stats")

print(price)
我得到这张照片:

[]

我把这个脚本用于我所有的其他网页,这是我第一次得到这样的东西

我试着四处看看,问一些人,我仍然找不到解决方案。

检查page\u soup变量的值:

<html style="height:100%"><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=719d34d31c8e3a6e6fffd425f7e032f3"></script><script src="/Criciousand-meth-shake-Exit-be-till-in-ches-Shad" async></script></head><body style="margin:0px;height:100%"><iframe id="main-iframe" src="/_Incapsula_Resource?SWUDNSAI=30&xinfo=7-5532445-0%20NNNY%20RT%281620414344651%2056%29%20q%280%20-1%20-1%201%29%20r%281%20-1%29%20B12%2814%2c0%2c0%29%20U5&incident_id=1233000410021120939-28775082668132935&edet=12&cinfo=0e000000d694&rpinfo=0&cts=UC3pkO3NyZP9f4EA4%2fm56lwz1Y6BhOV6CwF4xNVSeeeNp96DzLjUUDt3%2b5RYEDst" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 1233000410021120939-28775082668132935</iframe></body></html>
请求失败。Incapsula事件ID:123300041001210939-28775082668132935
如果您以匿名模式访问该网站,您将看到相同的结果


由于页面没有名为“stats”的类,因此页面“soup.find\u all”(class=“stats”)的结果是一个空列表。

当我在Chrome上查看时,HTML代码显示:“当前指导价”。。。。。我是不是误会了什么?你在一扇匿名的窗户里试过?在我第一次访问时,我必须解决验证码问题。只有在解决验证码后,才会加载所有内容是。我在隐姓埋名模式下试过,它不需要验证码。真奇怪。你认为我能从那里做什么?