why script still bring me main page (not logged in)? imagine email , pass good
import requests par = {'email':'addddd','pass':'ggdddssd'} r = requests.post('https://www.facebook.com',data=par) print (r.text) or trying trying search search bar on youtube:
<input id="masthead-search-term" name="search_query" value="" type="text" tabindex="1"title="rechercher"> import requests par = {'search_query':'good_songs_on_youtube'} r = requests.post('https://www.youtube.com',data=par) print (r.text) doesn't make search... ideas why?
you won't able login 2 reasons:
- when post html form - should use form's "action" url. example:
import requests url = 'https://www.facebook.com/login.php?login_attempt=1' #the form's action url par = {"email": "********", "password": "********"} # forms parameters r = requests.post(url, data=par) print (r.content) # can't use r.text because of encoding - in case, not enough cause fb requires cookies, might able program way out of it, won't easy/straight-forward.
so, how can login (programmatically) fb , post queries ? can install , use their sdk, , there open source projects such this one uses fb api , supports oauth well.
you have go https://developers.facebook.com/tools/explorer/ , api token in order use oauth authentication.
Comments
Post a Comment