在实现内容的爬取后,我想实现用户头像的下载。其实只需要在前一部分的代码中再加上关于图片url的链接即可。
第一个实例
- 图片url获取
def get_data(html ):
final = []
pictures = []存放图片url
bs = BeautifulSoup(html, "html.parser")
body = bs.body
content_left = body.find(id = 'content-left') #找到该页总框
contents = content_left.find_all('div',class_ = 'article block untagged mb15')#找到所有内容框
for content in contents: