0

I was trying to get post info from posts on Facebook like date, text, and post link.

I have tried a lot of methods but after login and going to the group I get stuck and cant get elements I want. It always return irrelevant results.

enter image description here]

Dave2e
  • 22,192
  • 18
  • 42
  • 50

1 Answers1

0

I used the selenium and mobile version of the Facebook site (m.facebook.com) to scrape data (mostly Xpath). It's easier to play with DOM in the mobile version.

There are many git repos out there on FB scraping, check whatever works for you. this one for example is pretty recent -

Facebook-Group-Post-Scraper

ahmedshahriar
  • 1,053
  • 7
  • 25
  • 1
    thanks a lot I will try doing this – abdelrahman amr Jan 18 '22 at 17:12
  • 1
    hi thanks it actually worked using mobile facebook except for the part when I try to get the text after see more I did get the hidden text at the inspect tool on google but when I try to code it it just doesn't get it – abdelrahman amr Jan 19 '22 at 01:53
  • Click on see more and then scrape those texts. Check "page_source" and debug instead of inspecting element – ahmedshahriar Jan 19 '22 at 02:08
  • 1
    thanks a lot that worked – abdelrahman amr Jan 19 '22 at 21:26
  • You're welcome. – ahmedshahriar Jan 20 '22 at 20:29
  • so do yo know a way to stop Facebook from blocking the account I did this but with all groups so after 20 groups or so then gets blocked for detecting fast activities I tried slowing but didn't work neither did proxies – abdelrahman amr Jan 22 '22 at 00:41
  • Use random delay, not fixed (ex- float second delay 1,5) + use proxy + use headful mode if it's applicable. Try with different webdriver solution, like this one - [undetected-chromedriver](https://github.com/ultrafunkamsterdam/undetected-chromedriver) – ahmedshahriar Jan 25 '22 at 05:11