forked from hankcs/RenrenAlbumDownloader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRenrenDownloader.py
executable file
·66 lines (60 loc) · 2.09 KB
/
RenrenDownloader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: Hua Liang [ Stupid ET ]
# email: et@everet.org
# website: http://EverET.org
#
# from imp import reload
import sys
import codecs
# from setuptools.compat import execfile
from Renren import SuperRenren
import time, os
def main():
# dl, dg = {}, {}
# execfile('user.txt', dg, dl)
# try:
# username = dl['username']
# password = dl['password']
# cookie = dl['cookie']
# except:
# pass
renren = SuperRenren()
renren.Create('18911029092', 'THUcst)(')
# renren.DownloadAlbumInfo(['415604935'], path = 'y:/info', threadnum = 7)
data = renren.GetRelationship()
fi=open('y:/'+unicode(renren.requester.GetUserId())+'.txt','w')
for item in data:
fi.write(str(item['id']) + " " + item['name'] + "\n")
for i in item['friends']:
fi.write('\t' + str(i[0]) + " " + i[1] + '\n')
fi.close()
print 'done'
raw_input()
f=open('user.txt')
for username in f:
if username[0] == '#': continue
print 'login using ' + username
if renren.Create(username, 'THUcst)('):
f2 = open('2.txt')
for l in f2:
renren.DownloadAlbum(l.strip(),'y:/albums',threadnum = 10)
# list = renren.GetFriendList()
# fi=open('y:/'+unicode(renren.requester.GetUserId())+'.txt','w')
# for l in list:
# # print l[1].encode('gb18030')
# fi.write(l[0] + " ")
# fi.write(l[1])
# fi.write('\n')
# fi.close()
# renren.DownloadAlbumInfo([i[0] for i in list], path = 'y:/info', threadnum = 7)
else:
print 'login failed.'
# renren.PostMsg(time.asctime())
# renren.PostGroupMsg('387635422', '%s' % time.asctime())
# renren.DownloadAlbum('333982368', 'sss')
# renren.DownloadAlbum('285201751', 'cai')
# renren.DownloadAlbum('339106868', 'y:/')
# renren.DownloadAllFriendsAlbums(path = 'y:/albums',threadnumber=100)
if __name__ == '__main__':
main()