moda20 / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
62 stars 24 forks source link

Get post problem #1

Closed HienNguyenPhan closed 7 months ago

HienNguyenPhan commented 7 months ago

I'm trying to crawl data from a facebook page but it doesn't do anything unfortunately, I'm really desperate pls help. I'm using the standard get post syntax post_list = [] for post in get_posts(FANPAGE_LINK, options={"comments": True, "reactions": True, "allow_extra_requests": True}, extra_info=True, pages=PAGES_NUMBER, cookies=COOKIE_PATH): print(post) post_list.append(post)

basheerpaliyathu commented 7 months ago

did you set browser agent? if yes, try removing it.

moda20 commented 7 months ago

@HienNguyenPhan you need to use the start_url since the lib doesn't work with m.fb anymore :

for post in get_posts(account="nintendo", start_url="https://mbasic.facebook.com/nintendo?v=timeline",
              cookies='<Path to your cookies file>')) : 
    print(post['text'][:50])

You should also extract new cookies, as the old ones can also fail at scrapping with this library

moda20 commented 7 months ago

@HienNguyenPhan i am closing this issue since we solved this isue on the og repo's issue