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

Truncated text post #69

Open
truephp opened this issue Oct 16, 2024 · 2 comments
Open

Truncated text post #69

truephp opened this issue Oct 16, 2024 · 2 comments

Comments

@truephp
Copy link

truephp commented Oct 16, 2024

Posts with More link are parsed only with text before this link.

@moda20
Copy link
Owner

moda20 commented Oct 19, 2024

@truephp can you post an example post ? and the script you are using to get it ?

@truephp
Copy link
Author

truephp commented Oct 25, 2024

@truephp can you post an example post ? and the script you are using to get it ?

@moda20, I've created a page for test, try this code

from facebook_scraper import get_posts
from facebook_scraper import exceptions
from facebook_scraper import enable_logging, write_posts_to_csv, get_profile
import simplejson as json
import os
import logging

enable_logging()
location = os.path.dirname(__file__)


try:
    #posts = get_posts(61567187803636, pages=1, cookies=os.path.join(location, "cookies.txt"), options={"posts_per_page": 5})
    posts = get_posts(61567187803636, start_url="https://mbasic.facebook.com/61567187803636?v=timeline", pages=1, cookies=os.path.join(location, "cookies.txt"), options={"posts_per_page": 10})
    json_object = json.dumps(posts, iterable_as_array=True, default=str)

    posts_file = os.path.join(location, 'poststext.json')
    with open(posts_file, "w") as outfile:
        outfile.write(json_object)
except exceptions.TemporarilyBanned:
    print("Temporarily banned")
except exceptions.AccountDisabled:
    print("Account Has Been Disabled")
except exceptions.InvalidCookies:
    print("Cookies are not valid")
except Exception as e:
    print(e.args)

This script only parse the next text

Once upon a time in a quiet, misty village nestled between ancient woods and a winding river, there was a curious girl named Maren. She loved wandering through the fields and forest paths, often straying far from the village. She sought the unknown, the hidden, the stories no one else could tell.\n\nOne late autumn day, as the sun dipped beneath the horizon and a soft orange glow filled the sky, Maren stumbled upon a peculiar sight. A fox, sleek and silver, with piercing eyes like moonlight, was...

but the original text is

Once upon a time in a quiet, misty village nestled between ancient woods and a winding river, there was a curious girl named Maren. She loved wandering through the fields and forest paths, often straying far from the village. She sought the unknown, the hidden, the stories no one else could tell.

One late autumn day, as the sun dipped beneath the horizon and a soft orange glow filled the sky, Maren stumbled upon a peculiar sight. A fox, sleek and silver, with piercing eyes like moonlight, was sitting by an old, twisted tree. It didn’t flee at her approach. Instead, it looked at her as if it had been waiting.

“Hello,” Maren whispered, unsure if the fox could understand. But to her amazement, the fox tilted its head and spoke in a voice as soft as rustling leaves.

“I’ve been watching you, Maren. You walk these lands with a heart full of wonder, and it is rare to find such hearts. Will you listen to a tale that most would never believe?”

Maren, stunned but intrigued, nodded. She sat on the mossy ground, her eyes wide with anticipation.

The fox began, “Once, long ago, this land was home to more than just humans. Spirits roamed the forests, their laughter echoing through the trees, their songs as wild as the rivers. But over time, they faded, forgotten by those who couldn’t see or hear. Yet a few of us remain, carrying memories and whispers of that forgotten world.”

As the fox spoke, Maren felt as if the very air was alive with magic, as if the forest itself held its breath. She listened until the sky turned dark, absorbing tales of ancient spirits, hidden paths, and lost realms. When the fox’s tale ended, it rose and gazed at her kindly.

“You are part of these stories now,” it said. “If you listen closely, you may hear the voices that few remember. Keep your heart open, and you’ll find more than you ever imagined.”

With that, the fox vanished into the shadows, leaving Maren alone but forever changed. She returned to the village, feeling as if the whole world had grown richer, more mysterious, and brimming with secrets that only a rare few would ever know. And as she grew older, she often returned to that tree, hoping to see her fox friend again, always listening for the stories hidden within the forest's quiet whispers.

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

2 participants