File tree 1 file changed +21
-16
lines changed
1 file changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ def parse():
24
24
return qq , pwd
25
25
26
26
27
- def func (url , tp ):
27
+ def func (hostqq , url , tp ):
28
28
try :
29
29
data = web .Request (url , type = tp )
30
- pic = file ('%s/%s.%s' % (test_qq , str (random .random ()), tp ), 'wb' )
30
+ pic = file ('%s/%s.%s' % (hostqq , str (random .random ()), tp ), 'wb' )
31
31
pic .write (data )
32
32
pic .close ()
33
33
except Exception , e :
@@ -43,6 +43,23 @@ def multi(qq):
43
43
s .wait_allfinish ()
44
44
45
45
46
+ def getAlbum (qq ):
47
+
48
+ global test_qq
49
+ test_qq = '' # 要爬取人的qq号, 不写默认为空。
50
+ qq .getAlbumList (test_qq )
51
+ # qq.getAlbumList() 无参数默认爬取自己的相册
52
+
53
+ if len (qq .picUrl ) < 2 :
54
+ print 'few pictures'
55
+ else :
56
+ if test_qq == '' :
57
+ test_qq = qq .qq # 默认是自己的号码
58
+ if not os .path .exists (test_qq ):
59
+ os .mkdir (test_qq )
60
+ multi (qq )
61
+
62
+
46
63
def login ():
47
64
method = raw_input ('选择方式登录:1.二维码;2.帐号密码;\n ' )
48
65
if method == '1' :
@@ -60,17 +77,5 @@ def login():
60
77
61
78
if __name__ == '__main__' :
62
79
63
- qq = login ()
64
- global test_qq
65
- test_qq = '' # 要爬取人的qq号, 不写默认为空。
66
- qq .getAlbumList (test_qq )
67
- # qq.getAlbumList() 无参数默认爬取自己的相册
68
-
69
- if len (qq .picUrl ) < 2 :
70
- print 'few pictures'
71
- else :
72
- if test_qq == '' :
73
- test_qq = qq .qq # 默认是自己的号码
74
- if not os .path .exists (test_qq ):
75
- os .mkdir (test_qq )
76
- multi (qq )
80
+ qq = login () # 登录入口
81
+ getAlbum (qq ) # 获取相册
You can’t perform that action at this time.
0 commit comments