0
我想写一个蜘蛛抓取一个html。我使用requests
和beautifulsoup
,但我发现美丽的脸不能分析整个页面。相反,Beautifulsoup只是解析它的一半。 这里是我的代码:Beaultifusoup无法解析所有的html
import requests
from bs4 import BeautifulSoup as bs
urls = ['http://www.bishefuwu.com/developer/transmit','http://www.bishefuwu.com/developer/transmit/index/p/2.html']
html = requests.get(urls[0]).content
soup = bs(html,'lxml')
table = soup.find('tbody')
trs = table.find_all('tr')
for tr in trs:
r = tr.find_all('td')[:3]
for i in map(lambda x:x.get_text(),r):
print i
,这是the origin page,里面有行“13107”, 但我的蜘蛛只是有它的一半,我排停在“13192”。 为了测试,我手动保存requests
所要求的原始HTML,我发现一切都很好。这个错误在Beautifulsoup上。 我该如何解决它? 谢谢
非常感谢! – ucag