Skip to content

Commit

Permalink
facebook: add is_temporarily_blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Nov 7, 2023
1 parent 21585c4 commit b14d03b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions automon/integrations/facebook/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class FacebookGroups(object):
_xpath_title = [
'/html/body/div[1]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div[1]/div[2]/div/div/div/div/div[1]/div/div/div/div/div/div[1]/h1/span/a',
]
_xpath_temporarily_blocked = [
'/html/body/div[1]/div[2]/div[1]/div/div/div[1]/div/div[2]/h2',
'/html/body/div[1]/div[2]/div[1]/div/div/div[1]/div/div[2]',
]
_xpath_members = [
'/html/body/div[1]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div/div[2]/div/div/div[4]/div/div/div/div/div/div[3]/div/div/div/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/span',
'/html/body/div[1]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div[4]/div/div/div/div/div/div[3]/div/div/div/div/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/span',
Expand Down Expand Up @@ -64,6 +68,7 @@ def __init__(self, url: str = None):
self._posts_today_count = None
self._privacy = None
self._privacy_details = None
self._temporarily_blocked = None
self._title = None
self._url = url
self._visible = None
Expand Down Expand Up @@ -137,6 +142,28 @@ def history(self):

return self._history

def is_temporarily_blocked(self):
if not self._browser:
return

try:
xpath_temporarily_blocked = self._browser.wait_for_xpath(
self._xpath_temporarily_blocked
)
self._temporarily_blocked = self._browser.find_xpath(
xpath_temporarily_blocked
).text
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
log.error(str(dict(
url=self.url,
message=message,
session=session,
stacktrace=stacktrace,
)))

return self._temporarily_blocked

@property
def members(self):
if not self._browser:
Expand Down

0 comments on commit b14d03b

Please sign in to comment.