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.

weird get_posts() behavior/bug

See original GitHub issue

I normally call get_posts() like this:

posts = get_posts(username, cookies=cookie_file, extra_info=True,
                  options={'page_limit': None, 'allow_extra_requests': False, 'HQ_images': False})

But for posts 10215606930220434, 10111743443272349 and 10229044620250382 this doesn’t return the correct number of likes/reaction_count (it returns 0) but this:

posts = get_posts(username, cookies=cookie_file, extra_info=True,
                  options={'page_limit': None, 'allow_extra_requests': False, 'reactors': True, 'HQ_images': False})

does. For every other post I’ve seen, they both return the number of likes/reaction_count properly.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
curiousier-georgecommented, Jul 26, 2022

Thanks.

Now it seems that

posts = get_posts(username, cookies=cookie_file, extra_info=True,
                  options={'page_limit': None, 'allow_extra_requests': False, 'HQ_images': False})

never returns non-0 values for likes/reaction_count. Does this mean Facebook is changing the HTML format overall?

I’m trying to minimize request count, so I’d like to avoid having to get posts one by one.

0reactions
neon-ninjacommented, Jul 28, 2022

https://github.com/kevinzg/facebook-scraper/commit/40c1e8a6f81d7a89256abaa0811b301875e1a6d8 should set reaction_count. Usually this would only get set if you set options: "reactions", but this would involve an extra request (to something like https://m.facebook.com/ufi/reaction/profile/browser/?ft_ent_identifier=10229047171274156)

I think you’re thinking of the posts_per_page parameter

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strange get_the_* behavior with php 5.4
With PHP 5.2, it works as expected. I updated to PHP 5.4, and get_the_content() is returning the parent content, instead of the current...
Read more >
12821 (Merge get_posts() and get_pages()) - WordPress Trac
Attempting to maintain the order of IDs as given and ran into this strange decade-old behavior. Using get_posts() with post__in works as expected, ......
Read more >
get_field() resets $post? - ACF Support
Today i noticed strange behavior which seems caused by get_field ... The same post is output before and after using get_field() , so...
Read more >
Wordpress permalink strange behavior: output depends on ...
I can't see an error themes very strange to me. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> ......
Read more >
wordpress-custom-content-type-manager - issue #246 - Google Code
advanced search operators in get_posts (greater than, less than) ... not numerically, which makes things weird... but it does look like it's working....
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