kevinzg / facebook-scraper

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

No raw posts in get_posts #1075

Closed Saul-Github closed 11 months ago

Saul-Github commented 11 months ago

When I was trying to get posts by the following codes, I did not got error, or results. I only got WARNING: facebook_scraper.page_iterators:No raw posts (article elements) were found in this page


for post in get_posts(account='nintendo', cookies='/content/79c6ad1a-78ce-4348-949d-a581ff555f6b.txt', pages=5):
  print(post)
moda20 commented 11 months ago

@Saul-Github check here : https://github.com/moda20/facebook-scraper/commit/14574499324bb425560085116eb5040c0db0aad7#commitcomment-134092869

and here : https://github.com/kevinzg/facebook-scraper/issues/1070

TBKRK commented 11 months ago

I have the same problem since December 2nd. Previously I could receive posts from one account, now I only receive empty []. Configuring start_url does not solve the problem. I use cookies, but changing to "credentials", even with other user or different IP doesn't help. Has Facebook made any changes?

moda20 commented 11 months ago

@TBKRK they did some changes, they always do in fact, regularly. be sure you are using the right credentials,

HienNguyenPhan commented 11 months ago

Does anyone here has any solution, maybe an alternative. I'm desperate

TBKRK commented 11 months ago

@moda20 credentials are fine... It just stopped working...

volodkindv commented 11 months ago

The same problem. First in FB's responses disappeared "top_level_post_id". Then disappeared something else, I don't understand yet.

moda20 commented 11 months ago

@volodkindv Yes mbasic stopped returning "top_level_post_id", i updated my repo (https://github.com/moda20/facebook-scraper) to get the id form other places

HienNguyenPhan commented 11 months ago

@moda20 So hey I'm quite new how can I install and use your repo instead of the master one

moda20 commented 11 months ago

@HienNguyenPhan remove the existent facebook-scrapper entry in you requirements.txt and replace it with this : facebook-scraper @ git+https://github.com/moda20/facebook-scraper.git@master and run the install command

or use pip to force update the repo like this :

pip install --force-reinstall --no-deps git+https://github.com/moda20/facebook-scraper.git@master
TBKRK commented 11 months ago

@moda20 Hello, maybe it solves "top_level_post_id" problem but my script still doesn't work: from facebook_scraper import get_posts

x = get_posts(account='mpkkrakow', cookies='cookies.json', pages=5)

print(x)

for post in x: print(post)

moda20 commented 11 months ago

@TBKRK please do the research, you need to use teh start_url attribute to get the posts, the default url uses m.facebook which is not supported anymore for most regions and cookies , check here : https://github.com/kevinzg/facebook-scraper/issues/1070#issuecomment-1837606566

TBKRK commented 11 months ago

@moda20 still the same :(

from facebook_scraper import get_posts

x = get_posts(account = "mpkkrakow", start_url="https://mbasic.facebook.com/mpkkrakow?v=timeline", cookies='cookies.json', pages=5)

print(x)

for post in x: print(post)

TBKRK commented 11 months ago

@moda20 wait... I changet to "credentials" and different user/password - it works! Maybe my account is banned?

moda20 commented 11 months ago

try to extract new cookies from the main website, visit all the 3 different websites (fb.com, m.fb.com, mbasic.fb.com) and then extract your new cookies in TXT format, old ones will not work. also be sure that you can access your cookies from where your script it being ran

TBKRK commented 11 months ago

@moda20 ok... It works with my old credentials. I extracted new cookies - it also works!

Thank you!

TBKRK commented 11 months ago

@moda20 one more... please take a look at attached screen. Some posts have bigger font size. They are not get properly from the page (only part of the text is loaded) :(

fb

aymen-ch commented 11 months ago

@moda20 when I use your solution I cannot have more than 5 posts even when I indicate the number of pages at 20

moda20 commented 11 months ago

@aymen-ch Please open a new issue on my repo with a bit more details