Skip to content

Commit fbebbc5

Browse files
authored
Update cosplay_la.py
1 parent e4429da commit fbebbc5

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

Python/reptile/cosplay_la.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,25 @@ def userFansCount(self, userHomeUrl, uid):
9999
num += 1
100100

101101
# 用户的关注
102-
def userFocusCount(self, userHomeUrl):
103-
pass
102+
def userFocusCount(self, userHomeUrl, uid):
103+
print("开始爬取 {} 的粉丝".format(userHomeUrl))
104+
num = 1
105+
while True:
106+
print("正在爬取第 '{}' 轮粉丝".format(num))
107+
postData = {
108+
'p': num,
109+
'action': 5,
110+
'uid': uid
111+
}
112+
focusPostResponse = json.loads(self.session.post(userHomeUrl + "/user/GetUserFriends", data=postData).text)
113+
if focusPostResponse['Data'] == []:
114+
print("'{}' 用户的粉丝已完, 共计 '{}' 个".format(userHomeUrl, num))
115+
break
116+
else:
117+
for fs in focusPostResponse['Data']:
118+
focusInformation = self.getUserInformation("http://home.cosplay.la/"+fs['Domain'])
119+
print(focusInformation)
120+
num += 1
104121

105122
def main(self):
106123
pageTotalNum = int(self.getPageTotalNum())
@@ -118,4 +135,4 @@ def main(self):
118135

119136
if __name__ == '__main__':
120137
cos = CosPlay()
121-
cos.main()
138+
cos.main()

0 commit comments

Comments
 (0)