kevinzg/facebook-scraper

No raw posts in get_posts

Closed this issue ยท 18 comments

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)
TBKRK commented

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

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

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

TBKRK commented

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

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

moda20 commented

@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

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

moda20 commented

@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

@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

@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 : #1070 (comment)

TBKRK commented

@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

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

moda20 commented

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

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

Thank you!

TBKRK commented

@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

@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

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