File tree Expand file tree Collapse file tree 1 file changed +27
-8
lines changed Expand file tree Collapse file tree 1 file changed +27
-8
lines changed Original file line number Diff line number Diff line change 1
1
import re
2
2
import requests
3
3
4
- temp = 'http://caodan.org/page /'
4
+ temp = 'http://wufazhuce.com/one /'
5
5
count = 1
6
- for i in range (1 , 1331 ):
6
+ for i in range (14 , 1580 ):
7
7
url = temp + str (i )
8
8
page = requests .get (url ).text
9
9
reg = re .compile ('src="(http://.*?\.jpg)"' )
10
10
img_url = re .findall (reg , page )
11
11
if img_url != []:
12
- with open ('E:/img/%s.jpg' % count , 'wb' ) as file :
13
- img_data = requests .get (img_url [0 ]).content
14
- file .write (img_data )
15
- count += 1
16
- else :
17
- continue
12
+ with open ('./{}.jpg' .format (count ), 'wb' ) as file :
13
+ try :
14
+ img_data = requests .get (img_url [0 ]).content
15
+ file .write (img_data )
16
+ count += 1
17
+ except :
18
+ pass
18
19
print ('OK!' )
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
You can’t perform that action at this time.
0 commit comments