Login to Facebook using python requests

后端 未结 9 2322
自闭症患者
自闭症患者 2020-11-27 11:18

I\'m trying to find a way to automatically login to Facebook without browser using Python. I experimented with \"requests\" lib. Tried several ways:

URL = \'         


        
9条回答
  •  野性不改
    2020-11-27 11:39

    I can say it's quite annoying to log in to Facebook without using their API. They also like to change everything so often it is quite the job to maintain the code.

    I did this a while ago, but I don't think my code is up to speed with current Facebook. However it should be a useful starting-point:

    https://gitorious.org/blogsmashonfb/blogsmashonfb/source/4f7ee94a56fdffe9392485df8999e340f97f4bbe:

    It has two parts, a webcrawler and a Facebook-handler (the latter is what you are interested in).

    One major issue you have in your code is that you must first visit Facebook, because they send you a login form with hidden elements that you need to send back.

提交回复
热议问题