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

Temporarily banned...friends scraper

Open topliftarm opened this issue 3 years ago • 8 comments

hi i am try to scrape friends by get_friends(_id, cookies="cookies.json" ,timeout=90, start_url=start_url, request_url_callback=handle_pagination_url)

with time.sleep(randint(5,15))

Question: i can see friend list of target in browser manually BUT programmatically Temporarily banned! why?

topliftarm avatar Nov 06 '21 04:11 topliftarm

You're probably scraping too much too fast. Increase your time.sleep. Try one minute per

neon-ninja avatar Nov 06 '21 05:11 neon-ninja

thanks, test it, why i can manually see and scroll down friends on facebook page without any problem! but with script banned?

when using m.facebook.com -> i have problem "We limit how often you can post, comment or do other .... " BUT when using facebook.com -> i Don't have any problem!

topliftarm avatar Nov 06 '21 05:11 topliftarm

The scraper uses m.facebook.com. The two domains have different rate limits

neon-ninja avatar Nov 06 '21 09:11 neon-ninja

Hi all, just wondering what are some of the ways to know whether you've been banned or not.

I see in this thread in particular, the message "We limit how often you can post, comment or do other .... " mentioned. On my end, I am just unable to see the posts that have been scraped, as the results for the scraping show up as blank (values of postText, postCount, postImage and postURL not being updated). I attach a snippet of code as follows

postText = ''
postCount = 0
postImage = ''
postURL = ''

for post in get_posts('MinistryofHealthTT', pages=1):
    if postCount == 2:  # change to 2 if no pinned included
        break
    else:
        postText    = post['text']
        postImage   = post['image']
        postURL     = post['post_url']
        postCount   = postCount + 1

please note that I am already logged in to my Facebook, so didn't include the credentials in the get_posts parameters.

Also, if I am indeed banned, how long does this last for, and how can I get around the ban?

Looking forward to hearing form you all, with thanks.

bessiethacow avatar Nov 08 '21 00:11 bessiethacow

Hi @bessiethacow - I don't think you're banned, I just think you're scraping Facebook unauthenticated. This page requires you to be logged in to see posts (try open https://m.facebook.com/MinistryofHealthTT in an incognito or inprivate window). You will need to pass cookies or credentials to the scraper as per the readme, it doesn't automatically share cookies with your browser.

neon-ninja avatar Nov 08 '21 00:11 neon-ninja

That might be a useful function though, I've added that new functionality in https://github.com/kevinzg/facebook-scraper/commit/b0acdf28defc5352182d91d056de757638419def

neon-ninja avatar Nov 08 '21 01:11 neon-ninja

I have 2200 friends and I request get_posts from each of my friends and sleep for 90 seconds. After scraping 180 friends's posts and almost 5 hours I got banned. And ban is for 2 days. What to do :(

Tsarikovich avatar Nov 12 '21 16:11 Tsarikovich

That doesn't sound reasonable for a human to do. See https://github.com/kevinzg/facebook-scraper/issues/409#issuecomment-907639417

neon-ninja avatar Nov 12 '21 18:11 neon-ninja