question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can get only comments numbers but comments_full is empty

See original GitHub issue

I’m having problems with comments extraction during the scraping: i have the correct number of comments in ‘comments’ but i’ve the full comments list only for few post, the most are empty.

PAGES = 3
TIMEOUT = 90
EXTRA_INFO = True
OPTIONS = {"comments": True, "posts_per_page": 100, "reactors": True, "allow_extra_requests": True}
PAGE = "380062975349225"


def scrape_page():
    results = list()
    for post in get_posts(
            account=PAGE,
            pages=PAGES,
            extra_info=EXTRA_INFO,
            timeout=TIMEOUT,
            credentials=(user, pw),
            options=OPTIONS
    ):
        results.append(post)

    return results

This is an example of post from the scraping

{'post_id': '4711949398827206', 'text': 'Coordinamento [...], 'comments': 37, [...] 'comments_full': [], '}

This link is a file with the result i’ve obtained from the previous code: https://seupload.com/5Ca/scrape_results.txt I’ve the same problem also using cookies instead of credentials.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Ianneeecommented, Jan 10, 2022

@Ianneee I think db3c117 should fix the issue with video posts redirecting to /watch/. … Please give it a try when convenient and let me know if it works for you.

The logger says “No comments area found” but the comments are correctly extracted, so it works! Thanks!

0reactions
neon-ninjacommented, Jan 6, 2022

@Ianneee I think https://github.com/kevinzg/facebook-scraper/commit/db3c117508cbee27b48190947bedf855b2b16166 should fix the issue with video posts redirecting to /watch/. With this commit, and this test code:

enable_logging()
set_cookies("cookies.json")

for post in get_posts(380062975349225, options={"comments": "generator", "posts_per_page": 50, "HQ_images": False}):
    if post["post_id"] == "4847017775320367": # This is an example post id on this page that redirects to /watch/
        pprint(post)
        pprint(next(post["comments_full"]))
        break

I get:

{'available': True,
 'comments': 3100,
 'comments_full': <generator object PostExtractor.extract_comments_full at 0x7fc5001d3200>,
 'factcheck': None,
 'image': None,
 'image_id': None,
 'image_ids': [],
 'image_lowquality': 'https://scontent.fakl8-1.fna.fbcdn.net/v/t15.5256-10/fr/cp0/e15/q65/269930032_614246283184456_7631295383436017789_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ccf8b3&efg=eyJpIjoidCJ9&_nc_ohc=Ry5rGHRy2dEAX-OaiR2&_nc_ht=scontent.fakl8-1.fna&oh=00_AT-S6zDsAoClJm-9BZmLi2m-ElBmS8y_9avNDFr649i7VA&oe=61DB723C',
 'images': None,
 'images_description': None,
 'images_lowquality': ['https://scontent.fakl8-1.fna.fbcdn.net/v/t15.5256-10/fr/cp0/e15/q65/269930032_614246283184456_7631295383436017789_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ccf8b3&efg=eyJpIjoidCJ9&_nc_ohc=Ry5rGHRy2dEAX-OaiR2&_nc_ht=scontent.fakl8-1.fna&oh=00_AT-S6zDsAoClJm-9BZmLi2m-ElBmS8y_9avNDFr649i7VA&oe=61DB723C'],
 'images_lowquality_description': [None],
 'is_live': False,
 'likes': 12000,
 'link': None,
 'links': [],
 'page_id': '380062975349225',
 'post_id': '4847017775320367',
 'post_text': 'Messaggio di fine anno di Stefano Puzzer. Contraccambiamo '
              'calorosamente i suoi auguri.\n'
              '\n'
              'Stefano Puzzer end of year message. We warmly return his '
              'wishes.',
 'post_url': 'https://facebook.com/380062975349225/posts/4847017775320367',
 'reaction_count': None,
 'reactions': None,
 'reactors': None,
 'shared_post_id': None,
 'shared_post_url': None,
 'shared_text': '',
 'shared_time': None,
 'shared_user_id': None,
 'shared_username': None,
 'sharers': None,
 'shares': 1900,
 'text': 'Messaggio di fine anno di Stefano Puzzer. Contraccambiamo '
         'calorosamente i suoi auguri.\n'
         '\n'
         'Stefano Puzzer end of year message. We warmly return his wishes.',
 'time': datetime.datetime(2021, 12, 31, 6, 7, 58),
 'timestamp': 1640884078,
 'user_id': '380062975349225',
 'user_url': 'https://facebook.com/9dicembrerivoluzione/?__tn__=C-R',
 'username': 'No Green Pass Nazionale',
 'video': 'https://video.fakl8-1.fna.fbcdn.net/v/t42.1790-2/269980831_1296282650795186_6796098083077919792_n.mp4?_nc_cat=110&ccb=1-5&_nc_sid=985c63&efg=eyJ2ZW5jb2RlX3RhZyI6InN2ZV9zZCJ9&_nc_ohc=AvkEE1TVZk8AX-5_aP8&_nc_rml=0&_nc_ht=video.fakl8-1.fna&oh=00_AT-xLMb0QrdrbEmPH06LGdeqtRtJQI67lq0H-ea42FoBaQ&oe=61D78D5B',
 'video_duration_seconds': None,
 'video_height': None,
 'video_id': '614245519851199',
 'video_quality': None,
 'video_size_MB': None,
 'video_thumbnail': 'https://scontent.fakl8-1.fna.fbcdn.net/v/t15.5256-10/fr/cp0/e15/q65/269930032_614246283184456_7631295383436017789_n.jpg?_nc_cat=109&ccb=1-5&_nc_sid=ccf8b3&efg=eyJpIjoidCJ9&_nc_ohc=Ry5rGHRy2dEAX-OaiR2&_nc_ht=scontent.fakl8-1.fna&oh=00_AT-S6zDsAoClJm-9BZmLi2m-ElBmS8y_9avNDFr649i7VA&oe=61DB723C',
 'video_watches': None,
 'video_width': None,
 'w3_fb_url': None,
 'was_live': False,
 'with': None}
{'comment_id': '248994497354878',
 'comment_image': None,
 'comment_reaction_count': None,
 'comment_reactions': None,
 'comment_reactors': [],
 'comment_text': 'Un grande esempio quello di Stefano e i portuali. Siete nel '
                 'giusto e sono certa che la verità verrà a galla presto. Buon '
                 'nuovo anno a tutti voi e che dio vi benedica',
 'comment_time': datetime.datetime(2022, 1, 3, 0, 0),
 'comment_url': 'https://facebook.com/248994497354878',
 'commenter_id': '1540462526',
 'commenter_meta': None,
 'commenter_name': 'Silvia Tintorri',
 'commenter_url': 'https://facebook.com/silvia.tintorri.9?fref=nf&rc=p&refid=52&__tn__=R',
 'replies': []}

Please give it a try when convenient and let me know if it works for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do the comments number on Youtube sometimes not ...
The moment it's sent BEFORE actually getting deleted, the counter goes up by 1, but when they DELETE that comment, it doesn't go...
Read more >
How to fix YouTube Not Showing Comments
Is YouTube not showing comments ? Here is a quick fix.First, make sure to update the YouTube app if this is happening on...
Read more >
Add or reply to comments in Numbers for iCloud - Apple Support
In Numbers for iCloud, add comments to text, tables, and other objects. Reply to comments, delete comments, and show or hide comments.
Read more >
Experiment: What Happens When You Buy TikTok Comments
The comments you're buying for TikTok aren't from potential customers or fans, so they won't deliver you any real value — just empty...
Read more >
Empty `comments_full` in live post · Issue #575 - GitHub
Hi @neon-ninja, I'm trying to get comments from live posts: ... cookies.txt"), options={'comments': True} )) but can't get any comment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found