Skip to content

Commit

Permalink
Changed log in function to use different headers (#860)
Browse files Browse the repository at this point in the history
and not the mobile site, as per issue 858. Code
suggested by @nikbpetrov and @SerafinGranados
  • Loading branch information
bipsen authored Aug 26, 2022
1 parent d370486 commit efe14c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions facebook_scraper/facebook_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ class FacebookScraper:

base_url = FB_MOBILE_BASE_URL
default_headers = {
'Accept-Language': 'en-US,en;q=0.5',
"Sec-Fetch-User": "?1",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8",
}
"Accept": "*/*",
"Connection": "keep-alive",
"Accept-Encoding": "gzip,deflate",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8"
}
have_checked_locale = False

def __init__(self, session=None, requests_kwargs=None):
Expand Down Expand Up @@ -998,7 +999,7 @@ def login(self, email: str, password: str):

def is_logged_in(self) -> bool:
try:
self.get('https://m.facebook.com/settings')
self.get('https://facebook.com/settings')
return True
except exceptions.LoginRequired:
return False
Expand Down

0 comments on commit efe14c9

Please sign in to comment.