|
...
|
...
|
@@ -80,7 +80,7 @@ class PCState(State): |
|
|
|
|
|
|
|
user_id = get_user_id(session)
|
|
|
|
|
|
|
|
r = session.get(_util.prefix_url("/"),timeout=10)
|
|
|
|
r = session.get(_util.prefix_url("/"), timeout=10)
|
|
|
|
|
|
|
|
b = parse_html.show_home_page(r.text)
|
|
|
|
logout_menu = b.find('div', id='logoutMenu')
|
|
...
|
...
|
@@ -451,15 +451,16 @@ class FacebookClient(Client): |
|
|
|
:return (ID,Name)
|
|
|
|
'''
|
|
|
|
total_ids = []
|
|
|
|
ids, names, gender = [], [], []
|
|
|
|
res = []
|
|
|
|
|
|
|
|
while True:
|
|
|
|
if not (ids or names):
|
|
|
|
ids, names, gender = self._pymk_request(total_ids)
|
|
|
|
if not res:
|
|
|
|
res = self._pymk_request(total_ids)
|
|
|
|
ids = [x['fbid'] for x in res]
|
|
|
|
total_ids.extend(ids)
|
|
|
|
if not ids:
|
|
|
|
return
|
|
|
|
sub = (ids.pop(0), names.pop(0), gender.pop(0))
|
|
|
|
sub = res.pop(0)
|
|
|
|
yield sub
|
|
|
|
|
|
|
|
def _pymk_request(self, total_ids: list):
|
|
...
|
...
|
@@ -527,17 +528,20 @@ class FacebookClient(Client): |
|
|
|
'''发出的加好友请求'''
|
|
|
|
url = None
|
|
|
|
empty = False
|
|
|
|
ids, names = [], []
|
|
|
|
res = []
|
|
|
|
|
|
|
|
while True:
|
|
|
|
if not (ids or names):
|
|
|
|
if not res:
|
|
|
|
if empty:
|
|
|
|
return
|
|
|
|
ids, names, url = self._outgoingRequest(url)
|
|
|
|
res, url = self._outgoingRequest(url)
|
|
|
|
if not url:
|
|
|
|
empty = True
|
|
|
|
sub = (ids.pop(0), names.pop(0))
|
|
|
|
yield sub
|
|
|
|
if not res:
|
|
|
|
empty = True
|
|
|
|
else:
|
|
|
|
sub = res.pop(0)
|
|
|
|
yield sub
|
|
|
|
|
|
|
|
def _outgoingRequest(self, url=None, require_gender=True):
|
|
|
|
if url:
|
|
...
|
...
|
@@ -713,3 +717,18 @@ class FacebookClient(Client): |
|
|
|
|
|
|
|
def get_user_agent(self):
|
|
|
|
return self._state._session.headers.get('User-Agent', random.choice(_util.USER_AGENTS))
|
|
|
|
|
|
|
|
def searchForUserByFilter(self, name=None, city=None):
|
|
|
|
url = 'https://www.facebook.com/search/top/'
|
|
|
|
data = {'q': 'angel',
|
|
|
|
'ref': 'side_filter',
|
|
|
|
'epa': 'FILTERS',
|
|
|
|
'filters': 'eyJycF9sb2NhdGlvbiI6IntcIm5hbWVcIjpcImxvY2F0aW9uXCIsXCJhcmdzXCI6XCIxMDYyNjI4ODI3NDU2OThcIn0ifQ==',
|
|
|
|
'ajaxpipe': '1',
|
|
|
|
'ajaxpipe_token': 'AXjhI9q4VDQji6Ox',
|
|
|
|
'quickling[version]': '1001720869;0;'
|
|
|
|
}
|
|
|
|
# f = furl.furl(url).add(data)
|
|
|
|
# print(f.url)
|
|
|
|
res=self._state._get('https://www.facebook.com/search/people/?q=angel&epa=FILTERS&filters=eyJjaXR5Ijoie1wibmFtZVwiOlwidXNlcnNfbG9jYXRpb25cIixcImFyZ3NcIjpcIjEwNjI2Mjg4Mjc0NTY5OFwifSJ9&ref=side_filter',{})
|
|
|
|
print(res) |
|
|
\ No newline at end of file |
...
|
...
|
|