forked from darkbit001/cococat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweibo_profile_example.py
More file actions
52 lines (40 loc) · 1.04 KB
/
Copy pathweibo_profile_example.py
File metadata and controls
52 lines (40 loc) · 1.04 KB
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
#
# weibo_profile_example.py
#
# doufunao 2013-08-02
#
import sys
from weibocrawler import WeiboProfile
from weibocrawler import WeiboLogin
from weibocrawler import WeiboHttpRequest
def main():
username = 'f641679@rmqkr.net'
password = 'f641679'
url = 'http://weibo.com/u/'+sys.argv[1]
#url = 'http://weibo.com/p/1005051697142574/follow'
#print(url)
login = WeiboLogin(username, password)
http_request = WeiboHttpRequest(login)
text = http_request.get(url)
#Instantiate class profile
#text is the input strings
'''
with open('profile_temple.txt', mode = 'w', encoding = 'utf-8') as a_file:
num = a_file.write(text)
print(num)
'''
# Instantiating class
p = WeiboProfile(text)
profilelist = p.get_profile()
# insert an item into collection
# print all the document in collection
for x in profilelist:
print(x)
#This function is used in http://weibo.com/p/pageid
#or http://weibo.com/nickname
#or http://weibo.com/u/uid
followlist = p.get_list(flag = True)
for x in followlist:
print(x)
if __name__ == "__main__":
main()