小编use*_*035的帖子

Beautifulsoup 只返回 100 个元素

我是网络抓取的新手,想从 Spotrac 抓取大学项目的球员姓名和薪水。到目前为止,我所做的如下。

import requests
from bs4 import BeautifulSoup   

URL = 'https://www.spotrac.com/nfl/rankings/'

reqs = requests.get(URL)
soup = BeautifulSoup(reqs.text, 'lxml')
print("List of all the h1, h2, h3 :")
for my_tag in soup.find_all(class_="team-name"):
    print(my_tag.text)

for my_tag in soup.find_all(class_="info"):
    print(my_tag.text)    
Run Code Online (Sandbox Code Playgroud)

这个输出只有 100 个名字,但页面有 1000 个元素。有没有原因造成这种情况?

python beautifulsoup web-scraping

5
推荐指数
1
解决办法
197
查看次数

标签 统计

beautifulsoup ×1

python ×1

web-scraping ×1