作者 lemon

增加好友的好友的获取接口

... ... @@ -49,7 +49,6 @@ def message_receive(message):
monitor.execute(cmd)
elif type_ == 'initialize':
monitor.init_config = json.loads(data_)
except:
import traceback
print(traceback.format_exc())
... ...
... ... @@ -836,7 +836,7 @@ class FacebookClient(Client):
'ext_data': ext_data,
}
def friendsList(self, ext_data=None):
def friendsList(self, ext_data=None, fbid=None):
if ext_data:
ext_data = common.frombase64(ext_data)
... ... @@ -868,8 +868,15 @@ class FacebookClient(Client):
res = res['data']['node']
else:
res = self._state._session.get(self._state.page_url.replace('profile.php?id=', '') + '/friends')
if res.status_code == 200 and '/friends' in res.url:
if fbid:
# url = f'https://www.facebook.com/{fbid}/friends'
url = f'https://www.facebook.com/profile.php?id={fbid}&sk=friends'
else:
url = self._state.page_url.replace('profile.php?id=', '') + '/friends'
res = self._state._session.get(url)
if res.status_code == 200 and 'friends' in res.url:
res = parse_html.get_friend_div(res.text)
if not res:
respone = {
... ...
... ... @@ -52,7 +52,7 @@ class Do():
def three(self, x, y, z):
print(locals())
def createGroup(self,message,user_ids):
def createGroup(self, message, user_ids):
print(locals())
... ... @@ -65,7 +65,7 @@ if __name__ == '__main__':
f1 = join(d.two, {"x": 'x1', "y": 'y2', 'z': 'z3'})
f2 = join(d.one, 'x2')
f3 = join(d.createGroup,{"message":"12333","user_ids":[1,2,3,4,5]})
f3 = join(d.createGroup, {"message": "12333", "user_ids": [1, 2, 3, 4, 5]})
t.submit(**f1)
t.submit(**f2)
... ...
... ... @@ -189,9 +189,9 @@ def get_div_text(html):
def get_friend_div(text):
if 'ProfileCometAppSectionFriendsList' in text:
if 'TimelineAppCollectionListRenderer' in text:
b = bs4.BeautifulSoup(text, 'html.parser')
script = b.find('script', string=re.compile(r'ProfileCometAppSectionFriendsList'))
script = b.find('script', string=re.compile(r'TimelineAppCollectionListRenderer'))
a = re.findall(r'TimelineAppCollectionListRenderer",collection:(\{.*?\}\}\})', script.string)[0]
res = demjson.decode(a)
return res
... ...