Skip to content

Instantly share code, notes, and snippets.

@ProgramFilesx86
Last active September 12, 2019 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ProgramFilesx86/d6cdc91b0b11f0916b6fe8be8be224aa to your computer and use it in GitHub Desktop.
Save ProgramFilesx86/d6cdc91b0b11f0916b6fe8be8be224aa to your computer and use it in GitHub Desktop.
My f1st dictionnary att
import requests
import bs4 as bs
with requests.session() as c:
link="https://www.facebook.com/login.php?login_attempt=1&lwv=110" #link of the webpage to be logged in
initial=c.get(link) #passing the get request
login_data={"email":"xxxxxxxxxxxx","pass":"**********"} #the login
page_login=c.post(link, data=login_data)
#print(page_login) #checking status of requested page
page=c.get("https://www.facebook.com/profile.php?id=100008551898809") #requesting source code of logged in page
good_data = bs.BeautifulSoup(page.content, "lxml") #parsing it with BS4
print(good_data.title) #printing this gives the title that is got from the page when accessed from an logged-out account
with requests.session() as b:
link2="https://www.facebook.com/login.php?login_attempt=1&lwv=110" #link of the webpage to be logged in
initial=b.get(link2) #passing the get request
login_data2={"email":"xxxxxxxxxxx","pass":"*****"} #the login
page_login2=b.post(link2, data=login_data2)
#print(page_login2) #checking status of requested page
page2=b.get("https://www.facebook.com/profile.php?id=100008551898809") #requesting source code of logged in page
good_data2 = bs.BeautifulSoup(page2.content, "lxml") #parsing it with BS4
print(good_data2.title) #printing this gives the title that is got from the page when accessed from an logged-out account
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment