kevinzg / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
2.45k stars 633 forks source link

Scraper don't know where is the end of one group post #902

Closed IronEaterBeast closed 2 years ago

IronEaterBeast commented 2 years ago

Hi, when I scrape the group post. The 1st result includes all the posts. The 2nd result includes the posts from the 2nd to the last post. The 3rd result includes the posts from the 3rd to the last post. I don't know why.

This is my code:

from facebook_scraper import *
from pprint import pprint
import sys

set_user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36")

i=0
for post in get_posts(group="python", pages=1, cookies="important-cookie-4-facebook.txt", options={"comments": True}):
    pprint('text: ' + post['text'][:500]) 
    i=i+1
    if (i>4):
        break