From 3e43e3d9c2cf293cd35514ea689376473a73d206 Mon Sep 17 00:00:00 2001 From: Shun Li Date: Tue, 13 Feb 2018 09:02:17 +0800 Subject: [PATCH] url updated old one not work --- biyingSpider.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/biyingSpider.py b/biyingSpider.py index 86bf645..b5fae1e 100644 --- a/biyingSpider.py +++ b/biyingSpider.py @@ -5,10 +5,11 @@ local = time.strftime("%Y.%m.%d") url = 'http://cn.bing.com/' con = requests.get(url) content = con.text -reg = r"(http://s.cn.bing.net/az/hprichbg/rb/.*?.jpg)" +reg = r"(az/hprichbg/rb/.*?.jpg)" a = re.findall(reg, content, re.S)[0] print(a) -read = requests.get(a) +picUrl = url + a +read = requests.get(picUrl) f = open('%s.jpg' % local, 'wb') f.write(read.content) f.close()