我正在尝试使用Python中的BeautifulSoup从https://github.com/trending抓取趋势存储库的数量。该代码应该找到所有带有class_ =“ Box-row”的标签,然后打印找到的数字。在该站点上,趋势存储库的实际数量为25,但是代码仅返回9。
我尝试将解析器从“ html.parser”更改为“ lxml”,但都返回了相同的结果。
page = requests.get('https://github.com/trending')
soup = BeautifulSoup(page.text,'html.parser')
soup = BeautifulSoup(page.text)
repo = soup.find(class_ = "Box-row")
print(len(repo))
在html中,有25个带有“ Box-row”类属性的标签,因此我希望看到print(len(repo))= 25,但它是9。