作者 陈俊学

2.1.4

1.修复帐号密码登录接口(facebook更新)
2.增加拉黑好友接口 http://doc.gzntkj.com/web/#/22?page_id=1608
3.增加解除拉黑好友接口 http://doc.gzntkj.com/web/#/22?page_id=1609
@@ -4,5 +4,5 @@ SERVER: @@ -4,5 +4,5 @@ SERVER:
4 reconnect_interval: 3 4 reconnect_interval: 3
5 5
6 VERSION: 6 VERSION:
7 - code: 103  
8 - name: 2.1.3  
  7 + code: 104
  8 + name: 2.1.4
@@ -116,7 +116,7 @@ class MqttClient(mqtt.Client): @@ -116,7 +116,7 @@ class MqttClient(mqtt.Client):
116 'Origin': 'https://www.facebook.com', 116 'Origin': 'https://www.facebook.com',
117 'Host': 'edge-chat.facebook.com' 117 'Host': 'edge-chat.facebook.com'
118 } 118 }
119 - self.ws_set_options(path="/chat?sid={}".format(sessionid), headers=headers) 119 + self.ws_set_options(path="/chat?region=odn&sid={}".format(sessionid), headers=headers)
120 username = json.dumps(username, separators=(",", ":")) 120 username = json.dumps(username, separators=(",", ":"))
121 self.username_pw_set(username) 121 self.username_pw_set(username)
122 return self 122 return self
@@ -530,6 +530,32 @@ class FacebookClient(Client): @@ -530,6 +530,32 @@ class FacebookClient(Client):
530 result, _ = parse_html.friend_unit(j) 530 result, _ = parse_html.friend_unit(j)
531 return result 531 return result
532 532
  533 + def blockUser(self, fbid: str):
  534 + data = {
  535 + 'jazoest': self._state.jazoest,
  536 + 'fb_dtsg': self._state._fb_dtsg,
  537 + 'uid': fbid,
  538 + 'update_plite': None,
  539 + 'privacy_source': 'privacy_settings_page',
  540 + 'actionCheck': 'blockChecked',
  541 + }
  542 + res = self._post('https://www.facebook.com/privacy/block_user/', data)
  543 + if 'lid' in res:
  544 + return {"success": True}
  545 + return {"success": False}
  546 +
  547 + def unblockUser(self, fbid: str):
  548 + data = {
  549 + 'jazoest': self._state.jazoest,
  550 + 'fb_dtsg': self._state._fb_dtsg,
  551 + 'uid': fbid,
  552 + 'privacy_source': 'privacy_settings_page',
  553 + }
  554 + res = self._post('https://www.facebook.com/privacy/unblock_user/', data)
  555 + if 'lid' in res:
  556 + return {"success": True, 'msg': '请注意,你必须在 48 小时后才能再次拉黑'}
  557 + return {"success": False}
  558 +
533 def pymkRemove(self, fbid): 559 def pymkRemove(self, fbid):
534 ''' 560 '''
535 data = {'uid': fbid, 561 data = {'uid': fbid,
@@ -111,7 +111,6 @@ class PCState(State): @@ -111,7 +111,6 @@ class PCState(State):
111 data = dict((elem["name"], elem["value"]) 111 data = dict((elem["name"], elem["value"])
112 for elem in soup 112 for elem in soup
113 if elem.has_attr("value") and elem.has_attr("name")) 113 if elem.has_attr("value") and elem.has_attr("name"))
114 -  
115 pubkey, keyid = parse_html.get_publickey_id(text) 114 pubkey, keyid = parse_html.get_publickey_id(text)
116 115
117 data.update({ 116 data.update({
@@ -76,7 +76,7 @@ def _unit_html(p): @@ -76,7 +76,7 @@ def _unit_html(p):
76 76
77 def find_input_fields_with_pc(html): 77 def find_input_fields_with_pc(html):
78 b = bs4.BeautifulSoup(html, "html.parser") 78 b = bs4.BeautifulSoup(html, "html.parser")
79 - login_form = b.select("form[id=login_form]")[0] 79 + login_form = b.select("._featuredLogin__formContainer")[0]
80 return login_form.find_all("input") 80 return login_form.find_all("input")
81 81
82 82