Logging into facebook with python

后端 未结 5 1130
忘掉有多难
忘掉有多难 2020-12-09 06:46

If I run the following code 10 times in a row, it will work about half the time and fail the rest. Anyone know why?

import urllib2, cookielib, re, os, sys

c         


        
5条回答
  •  执笔经年
    2020-12-09 07:36

    So I tried your code, and got it to log in once, then like you I had trouble logging in again. On a line before the 'if' statement, I added print usock.read() and ended up getting a bunch of html code. I then dropped that code into a notepad, saved it as an html file, and pulled it up. This is what's happening: Facebook gets suspicious that we're logging in from a computer program, and is waiting for us to verify that we're real by showing a captcha word. The program doesn't account for this, and prints "Failed login" when it's really more of a pending login.

提交回复
热议问题