facebook-scraper icon indicating copy to clipboard operation
facebook-scraper copied to clipboard

Error: TemporarilyBanned pop out when set pages = 100

Open teohsinyee opened this issue 2 years ago • 3 comments

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)

error

teohsinyee avatar Mar 07 '22 10:03 teohsinyee

Also, it seems failed to extract the DateTime of the post. It shows empty when I check the dataframe.

teohsinyee avatar Mar 07 '22 10:03 teohsinyee

Does it ban even if you implement a delay? Maybe start with time.sleep(0.5) and reduce till it fails

Scylla2020 avatar Mar 10 '22 08:03 Scylla2020

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

neon-ninja avatar Mar 30 '22 01:03 neon-ninja

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])

GrimesSheenaLana avatar Nov 10 '22 03:11 GrimesSheenaLana