fbchat icon indicating copy to clipboard operation
fbchat copied to clipboard

Change method search fb_dtsg

Open hatienloi opened this issue 4 years ago • 1 comments

Description of the problem

The new facebook has a completely new interface, so your use of bs4 to search for fb_dtsg in this new interface is not satisfactory, I recommend using regex to search for fg_dtsg, this code is compatible with the interface. New and old interface

Code to reproduce

in def _from_session in _session.py should change

fb_dtsg_element = re.match(r'\"name\".+?\"fb_dtsg\".+?\"value\".+?\"(?P<fb_dtsg>.+?)\"',r.text)

if fb_dtsg_element:
    fb_dtsg = fb_dtsg_element.group("fb_dtsg")
else:
      # Fall back to searching with a regex
    res = FB_DTSG_REGEX.search(r.text)
    if not res:
        raise _exception.NotLoggedIn("Could not find fb_dtsg")
        fb_dtsg = res.group(1)

hatienloi avatar Apr 16 '20 02:04 hatienloi

Related to #546

I'll have a look at it, thanks for the suggestion 👍

madsmtm avatar May 06 '20 09:05 madsmtm