Facebook Page Scraping (Same results appears for two different pages)

190 views Asked by At

I'm attempting to scrape Facebook page data with facebook-scraper. However, I discovered that the same information is kept on both pages. How to fix this issue?. Need Help. Here is code:

import facebook_page_scraper
from facebook_page_scraper import Facebook_scraper

page_list = ['imrankhanofficial', 'arnold']

# Dictionary to map each page to a unique proxy port number
proxy_port_dict = {'imrankhanofficial': 10001, 'arnold': 10002}

posts_count = 10
browser = "firefox"

timeout = 300 #600 seconds
headless = False

# Dir for output if we scrape directly to CSV
directory = "D:/facebook_scrape_results"

for page in page_list:
# Get the proxy port number for the current page from the dictionary
proxy_port = proxy_port_dict[page]

# Build the proxy string for the current page
proxy = f'username:[email protected]:{proxy_port}'

# Increment the proxy port number for the next page
proxy_port_dict[page] += 1

# Initialize a scraper with the updated proxy string
scraper = Facebook_scraper(page, posts_count, browser, proxy=proxy, timeout=timeout, 
headless=headless)

# Running the scraper to scrape the current page
filename = page
scraper.scrap_to_csv(filename, directory)
0

There are 0 answers