Not giving post informations
Closed this issue · 1 comments
SilverFoxA commented
I'm trying to extract information on public Facebook posts from pages
I have used the exact example provided in the documentation
"""
Download comments for a public Facebook post.
"""
import facebook_scraper as fs
# get POST_ID from the URL of the post which can have the following structure:
# https://www.facebook.com/USER/posts/POST_ID
# https://www.facebook.com/groups/GROUP_ID/posts/POST_ID
POST_ID = "https://www.facebook.com/fifaworldcup/posts/pfbid0vpgD1z3HqV6ci2bmFdvMVTusjcSFudrB9v2AZRvm5Qizcbs56Kd3vK9zAx8Cf7Q8l"
# number of comments to download -- set this to True to download all comments
MAX_COMMENTS = 100
# get the post (this gives a generator)
gen = fs.get_posts(
post_urls=[POST_ID],
options={"comments": MAX_COMMENTS, "progress": True}
)
# take 1st element of the generator which is the post we requested
post = next(gen)
print(post)
# extract the comments part
comments = post['comments_full']
# process comments as you want...
for comment in comments:
# e.g. ...print them
print(comment)
# e.g. ...get the replies for them
for reply in comment['replies']:
print(' ', reply)
The response I have got is below. The response does not even provide basic post information, am i missing anything or there have been any change:
{'original_request_url': 'https://www.facebook.com/fifaworldcup/posts/pfbid0vpgD1z3HqV6ci2bmFdvMVTusjcSFudrB9v2AZRvm5Qizcbs56Kd3vK9zAx8Cf7Q8l', 'post_url': 'https://m.facebook.com/fifaworldcup/posts/pfbid0vpgD1z3HqV6ci2bmFdvMVTusjcSFudrB9v2AZRvm5Qizcbs56Kd3vK9zAx8Cf7Q8l'}
T
I would really appreciate any help on this.
SilverFoxA commented
Looks like the DOM elements have changed. I wrote my own script with selenium to scrap data from all types of facebook posts/reels/videos/photos.