Skip to content

Commit

Permalink
Merge pull request #27 from wael-sudo2/feature/update_facebook_scraper
Browse files Browse the repository at this point in the history
[Fix] location fetch
  • Loading branch information
wael-sudo2 authored Jan 26, 2024
2 parents 58b1b40 + 219dcb1 commit 40066b4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 6 additions & 3 deletions facebook_page_info_scraper/facebook_page_info_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,15 @@ def __private_geolocation(default_div):

def __private_fetch_location(self):
try:
location = None
web_element = self.info_web_element.find_element(
By.CLASS_NAME, value='x1hq5gj4')
if web_element.text.endswith('Address'):
location = web_element.text[:-len('Address ')]
location = web_element.find_element(By.CSS_SELECTOR,"span[dir='auto']").text

if location:
return location



location_web_element = web_element.find_element(By.CLASS_NAME,
value='x1n2onr6')
attrs = self.driver.execute_script(
Expand Down
12 changes: 12 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from facebook_page_info_scraper import FacebookPageInfoScraper

# providing the page URL
page_url = 'https://www.facebook.com/alexpoffisiell/'

# Create an instance of the scraper
scraper = FacebookPageInfoScraper(link=page_url)

page_info = scraper.get_page_info()

# Print page details
print(page_info)

0 comments on commit 40066b4

Please sign in to comment.