抓取页面中评书下载地址,网页源码能看到每一个评书标题,href地址 但是requests获取的href全部为#,评书名全部为 请到pingshu8下载 请问哪位大神能指教一下?代码如下 import requests from bs4 import BeautifulSoup import lxml if __name__=='__main__': url = 'http://www.pingshu8.com/MusicList/mmc_235_6576_1.Htm' r = requests.get(url, timeout=30) r.encoding = 'gb2312' bs = BeautifulSoup(r.text, 'lxml') pingshu_li = bs.find_all('li', class_='a1') print(pingshu_li.__len__()) for i in range(0, pingshu_li.__len__() - 1): name = pingshu_li[i].find('a').text href = pingshu_li[i].find('a')['href'] print(name, href)
Chasing_Cars
拖鞋_
相关分类