[问题] 用beautifulsoup find_all没找齐对应资料

楼主: Mutibil (nujabes)   2017-11-17 14:19:54
使用python 3.5版本
最近想摸一下beautifulsoup的功能
所以想爬broadway的网站,写个简易查询时刻表等功能
问题是这样的
先附上code
url= 'https://www.nyc.com/broadway_tickets/'
html = urllib.request.urlopen(url).read()
soup BeautifulSoup(html, 'html.parser')
dramaName = soup.find_all('h2')
dramaList = []
for i in dramaName:
Print(i.string)
dramList.append(i.string)
剧名是放在h2 底下,但我用find_all去找body底下的h2标签
只能找出局部的资讯,没办法找出所有的剧名
爬了一下stackflow, 有看到有些网站支援问题
有尝试把html.parser换成lxml,但问题还是存在
想请问有可能朝哪个方向去解决这问题呢?
谢谢
楼主: Mutibil (nujabes)   2017-11-17 14:51:00
我是用developer tool看 想说看起来都在同一页底下但刚刚看了一下page source 好像真的就那些资讯谢谢你 我再试试看
作者: ckc1ark (伪物)   2017-11-17 14:31:00
用developer panel可以看得出来他有querywww.nyc.com/broadway_ticketselements/?page=2 ~page=12

Links booklink

Contact Us: admin [ a t ] ucptt.com