Skip to content

Commit

Permalink
facebook: add check if login is required to view the page
Browse files Browse the repository at this point in the history
this is an indicator your ip address has been blocked.
  • Loading branch information
naisanzaa committed Oct 14, 2024
1 parent 70a4359 commit 332b58e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions automon/integrations/facebook/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ def __init__(self, url: str = None):

self._browser = SeleniumBrowser()

def blocked_by_login(self):
try:
element = self._browser.wait_for_anything(
match='You must log in to continue.',
value='div',
by=self._browser.by.TAG_NAME,
exact_match=True
)
if element:
element = element[0]
element = element.text
logger.debug(element)
return element
except Exception as error:
logger.error(error)

def close_login_popup(self):
try:
button = self._browser.find_anything(
Expand Down Expand Up @@ -553,6 +569,7 @@ def to_dict(self):
title=self.title(),
url=self.url,
visible=self.visible(),
blocked_by_login=self.blocked_by_login()
)

def quit(self):
Expand Down

0 comments on commit 332b58e

Please sign in to comment.