diff --git a/conf/config.yaml b/conf/config.yaml index 843eaf3..6883945 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -5,5 +5,5 @@ SERVER: control: http://fbchat.xyz:39002/api/terminal mark: ntkj VERSION: - code: 515 - name: 5.1.5 \ No newline at end of file + code: 516 + name: 5.1.6 \ No newline at end of file diff --git a/lib/facebook.py b/lib/facebook.py index 425938d..2c26102 100644 --- a/lib/facebook.py +++ b/lib/facebook.py @@ -2818,24 +2818,24 @@ class FacebookClient(Client): return self.f_res(res) def likeProfile(self, fbid, flag=True): - # type = 'profile' - # action = 'like' - # photo_id = self.getAlbumsCover(fbid, type) - # if photo_id: - # try: - # self.graph.put_like(fbid + '_' + photo_id) - # return {'success': True, 'photo_id': photo_id} - # except GraphAPIError as err: - # return {'success': False, 'photo_id': photo_id, 'errors': str(err)} - # # return self.feedbackActions(photo_id, action, flag) - # else: - # return {'success': False, 'errors': "未获取到头像的photo_id"} - text = self._state._session.get(f'https://www.facebook.com/{fbid}').text - a = re.findall(r'fbid=(.*?)&set=(.*?)","viewer_image"', text)[0] - text = self._state._session.get(f'https://www.facebook.com/photo/?fbid={a[0]}&set={a[1]}').text - feedback_id = re.findall(r'"feedback":{"id":"(.*?)","can_viewer_react"', text)[0] - return self.CometUFIFeedbackReactMutation(feedback_id=feedback_id, encrypted_tracking='', - feedback_source='MEDIA_VIEWER') + type = 'profile' + action = 'like' + photo_id = self.getAlbumsCover(fbid, type) + if photo_id: + try: + self.graph.put_like(fbid + '_' + photo_id) + return {'success': True, 'photo_id': photo_id} + except GraphAPIError as err: + return {'success': False, 'photo_id': photo_id, 'errors': str(err)} + # return self.feedbackActions(photo_id, action, flag) + else: + return {'success': False, 'errors': "未获取到头像的photo_id"} + # text = self._state._session.get(f'https://www.facebook.com/{fbid}').text + # a = re.findall(r'fbid=(.*?)&set=(.*?)","viewer_image"', text)[0] + # text = self._state._session.get(f'https://www.facebook.com/photo/?fbid={a[0]}&set={a[1]}').text + # feedback_id = re.findall(r'"feedback":{"id":"(.*?)","can_viewer_react"', text)[0] + # return self.CometUFIFeedbackReactMutation(feedback_id=feedback_id, encrypted_tracking='', + # feedback_source='MEDIA_VIEWER') def likeCover(self, fbid, flag=True): type = 'cover'