基本简介:
安装以及创建:
节点定位:
节点信息:
星巴克爬取:
from bs4 import BeautifulSoup
import urllib.request
url = 'https://www.starbucks.com.cn/menu/'
resp = urllib.request.urlopen(url)
context = resp.read().decode('utf-8')
soup = BeautifulSoup(context,'lxml')
obj = soup.select("ul[class='grid padded-3 product'] div[class='preview circle']")
for item in obj:
completePicUrl = 'https://www.starbucks.com.cn'+item.attrs.get('style').split('url("')[1].split('")')[0]
print(completePicUrl)
标签:www,cn,item,python,resp,BeautifulSoup,url,解析
From: https://www.cnblogs.com/dhcc/p/18299891