moda20 / facebook-scraper

Scrape Facebook public pages without an API key
MIT License
78 stars 28 forks source link

Failed to retrieve comments #4

Closed aymen-ch closed 9 months ago

aymen-ch commented 10 months ago

I can't retrieve comments with the code mentioned in the readme file

aymen-ch commented 10 months ago

@moda20 Please do you have a solution?

moda20 commented 10 months ago

@aymen-ch Pleaseput an example file that we can use as reference

aymen-ch commented 10 months ago

@moda20 This code does not work

POST_ID = "pfbid02NsuAiBU9o1ouwBrw1vYAQ7khcVXvz8F8zMvkVat9UJ6uiwdgojgddQRLpXcVBqYbl"

MAX_COMMENTS = 100

gen = fs.get_posts( post_urls=[POST_ID], options={"comments": MAX_COMMENTS, "progress": True} )

post = next(gen)

comments = post['comments_full']

moda20 commented 10 months ago

@aymen-ch please check the readme for the working example, it's not the same anymore example anymore

aymen-ch commented 10 months ago

@moda20 You can give me the working example because I didn't find it in the readme file

moda20 commented 10 months ago

@aymen-ch i updated the readme with the right info now, but here is an exampe using the nintendo page

postUrls = ['https://mbasic.facebook.com/nintendo/posts/739497288205876']
post = next( get_posts(post_urls=postUrls, cookies='cookies.txt', options={"allow_extra_requests": True, "comments": 100}))
print(post)

for now declaring the array separately is necessary because of some typing issues, will be resovled in the future

aymen-ch commented 10 months ago

@moda20 I tried the code but unfortunately it doesn't work it returns the post data but not the comments

moda20 commented 9 months ago

@aymen-ch I ahve added some updates to get the comments and their replies but i will need someone to try it and help with debugging. please try it yourself if you can

aymen-ch commented 9 months ago

@moda20 I executed the code but it does not return the comments and there is no error message

moda20 commented 9 months ago

@aymen-ch please include ann example input and output with your replies, i don't know what do you mean by it didn't work, i have added comments for the page scrapping, are you scrapping groups by chance ?

526319491 commented 9 months ago

gen = get_posts( post_urls=[POST_ID], options={"comments": MAX_COMMENTS, "progress": True}, cookies=cookiefile ) maybe you need cookies

moda20 commented 9 months ago

I am closing this since it seems to be stale, please open a new issue if you still can't get any comments