import requests
from bs4 import BeautifulSoup
html = requests.get('https://book.douban.com/').text
soup = BeautifulSoup(html, 'lxml')
html_content = soup.select('#content .slide-list li')
print('################################################################################################################################')
for i in html_content:
book = i.select('.cover a')
if len(book):
name = book[0].attrs['title']
link = book[0].attrs['href']
print('书名:%s,链接:%s' % (name, link))
print('################################################################################################################################')
Python爬虫(BeautifulSoup)实战:抓取豆瓣读书新书速递模块
最新推荐文章于 2024-07-24 17:16:09 发布