We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bddb61a commit 9bfc150Copy full SHA for 9bfc150
1 file changed
monkey/0013/main.py
@@ -13,20 +13,21 @@
13
def spider(url):
14
html = requests.get(url)
15
selector = etree.HTML(html.text)
16
+
17
picitems = []
- picitems = selector.xpath('//div[@id="post_content_29397251028"]/img[@class="BDE_Image"]')
18
- print(len(picitems));
+ picitems = selector.xpath('//div[@class="d_post_content j_d_post_content clearfix"]/img[@class="BDE_Image"]')
19
+ print(len(picitems))
20
21
i = 0
22
for pic in picitems:
23
url = pic.xpath('@src')[0]
- print(url)
24
+ #print(url)
25
dir = './%d.jpg'%i
26
download_Image(url, dir)
27
i += 1
28
29
-
30
+# 下载图片
31
def download_Image(url, save_path):
32
urllib.request.urlretrieve(url, save_path)
33
0 commit comments