kevinzg / facebook-scraper

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

get_posts with cookies work from my MacOS but not from Ubuntu server #1062

Open itaykrk opened 1 year ago

itaykrk commented 1 year ago

I run the same code with the same cookie file and target group on my Mac laptop and Ubuntu server.

On my Mac, it works and finds posts, and on the Ubuntu server, it doesn't raise an exception and doesn't find any post.

Any suggestions? not sure how to debug it at all.

alex440440 commented 10 months ago

@itaykrk Same for me, did you figure out what's the issue?

    post_urls=['https://www.facebook.com/memesdecolombiaaa/posts/999033537657270']
    gen = s_get_posts(
        post_urls=post_urls,
        options={"comments" : "generator", "reactions" : True, "allow_extra_requests": False},
        cookies="facebook_cookies_02.txt"
    )
    post = next(gen)

On Ububtu it returns just a dict of original_request_url and post_url, and on my local machine it returns the full post.

alex440440 commented 10 months ago

@itaykrk Same for me, did you figure out what's the issue?

    post_urls=['https://www.facebook.com/memesdecolombiaaa/posts/999033537657270']
    gen = s_get_posts(
        post_urls=post_urls,
        options={"comments" : "generator", "reactions" : True, "allow_extra_requests": False},
        cookies="facebook_cookies_02.txt"
    )
    post = next(gen)

On Ububtu it returns just a dict of original_request_url and post_url, and on my local machine it returns the full post.

When debugging, I saw that the user agents were different, and reinstalled the library. pip install --upgrade --force-reinstall facebook-scraper

After reinstall, the behavior was fixed. I don't know why different versions of the library got installed, the pip freeze on both machines reported facebook-scraper==0.2.59, but the code was different.