Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am geting only one post data only ,HOw can i get the all posts details of given urls #1093

Open
kumarlova opened this issue Mar 13, 2024 · 0 comments

Comments

@kumarlova
Copy link

listposts = []
MAX_COMMENTS=100

for post in get_posts("nintendo", pages=2):

posts = get_posts(post_urls=["https://www.facebook.com/britishairways","https://www.facebook.com/jemeeluAnna.Followers"],extra_info=True,credentials=('',''), options={"comments": MAX_COMMENTS, "progress": True})

for post in posts:

if isinstance(post, dict):
    # Print post on the screen
    print(post)
    print(json.dumps(post, indent=2, default=str))
    for x in post:
        print(x, post[x])
    # Print json object to file one object/post per line
    with open('fb.json', 'a', encoding='utf-8') as f:
        json.dump(post, f, ensure_ascii=False, default=str)
        f.write("\n")
    print(post.get('post_text', 'No post text available'))
    for cmt in post.get('comments_full', []):
        print(cmt.get('commenter_name', ''), " : ", cmt.get('comment_text', '').replace("\n", ""))
else:
    print("Post is not a dictionary:", post)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant