import requests
from bs4 import BeautifulSoup
import re
def getHTMLText(url):
try:
r = requests.get(url)
r.encoding = r.apparent_encoding
r.raise_for_status()
return r.text
except:
return ""
url = 'http://search.dangdang.com/?key=python&act=input'
html = getHTMLText(url)
pic_url = re.findall("img data-original='(.*?)' src"
爬取当当网图书图片
最新推荐文章于 2023-06-13 00:13:30 发布