kevinzg / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
2.46k stars 634 forks source link

How to extract posts of a group using a search param #344

Open jonatrios opened 3 years ago

jonatrios commented 3 years ago

Like: https://www.facebook.com/groups/267476487096763/**search/?q=tie**

I want to get all posts filter containing for example the keyword "tie" in that group. Maybe this is expleined issue #101 but im not sure if its refers the same.

neon-ninja commented 3 years ago

Like Kevin said in the issue you linked, "You would have to get all the posts and then filter them, currently there is no way to ask the server just for the posts you want."

jonatrios commented 3 years ago

Ok then, so here comes another question: in the pages optional parameter, could i set it to slice of pages so the next time my codes run start from the last page from the previous run?

neon-ninja commented 3 years ago

Not exactly - you can use request_url_callback and start_url to save pagination URLs and resume from them later on. See https://github.com/kevinzg/facebook-scraper/issues/310#issuecomment-852652846 and https://github.com/kevinzg/facebook-scraper/issues/336#issuecomment-860264215

jonatrios commented 3 years ago

Thanks so much for your time and dedication. This is an amazing tool! Nothing to do with this question but in the intro you said: "Inspired by twitter-scraper", I've tried but it didnt work, so, do you know any tool that gives the sames results as yours in twiter or do you have in mind to write your own twitter-scraper, maybe bring that module back to life again?

neon-ninja commented 3 years ago

Maybe try https://github.com/taspinar/twitterscraper or https://github.com/twintproject/twint