facebook-scraper
facebook-scraper copied to clipboard
Error: TemporarilyBanned pop out when set pages = 100
Hi everyone. I want to extract post from https://www.facebook.com/ustazahasmaharun/
Referring to 1st line code below, the pages parameter set is 100. It works perfectly when i set to 20. But only less than 90 posts are being extracted. My goal is to extract ALL posts if possible. (Up to thousands). Any solution?
for post in get_posts('ustazahasmaharun', pages=100, extra_info=True):
dataframe = post
df = pd.DataFrame.from_dict(dataframe, orient='index')
df = df.transpose()
df_ori = df_ori.append(df)
Also, it seems failed to extract the DateTime of the post. It shows empty when I check the dataframe.
Does it ban even if you implement a delay? Maybe start with time.sleep(0.5)
and reduce till it fails
Try pass cookies as per the readme. Also, try set options={"allow_extra_requests": False, "posts_per_page": 200}
, as that would massively speed things up, and reduce the number of requests, reducing the risk of temporary bans
Sorry to interrupt, but I am facing the same issue here (the post parsing stops around July 2021 and I would like to expand it to Nov 2019). May I ask how I could implement the delay to solve this issue? I also need to parse the comments for the posts. Thanks so much!
for post in get_posts('sghealthministry',pages=1000,cookies=cookie,options={"comments": True,"post_per_page": 300}):
df_temp = pd.DataFrame.from_dict(post, orient='index')
df_temp = df_temp.T
df=pd.concat([df,df_temp])