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.

Reactors not populating in get_post

See original GitHub issue

Hi. I’m trying a simple request on public page. I really need only reactors name (or any other id info) of a post and same info (user names and info) from all comments to the post. (if you can suggest me a complete request to do above).

I’m using current master

try: post = next(get_posts(post_urls=["160806872879026"], options={"reactors": True})) pprint(post)

Fetching 3000 reactors Found 0 reactors

‘reaction_count’: None, ‘reactions’: None, ‘reactors’: None,

other info seems ok.

Note: i receive locale warning UserWarning: Locale detected as it_IT - for best results, set to en_US

on a browser i noted that reactors div is referred as “reaction_profile_browser1” while in extractors i see “reaction_profile_browser” elems = list(response.html.find("div[id^='reaction_profile_browser']>div")) anyway changing it doesn’t work.

Thanks.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
neon-ninjacommented, Sep 30, 2021

You can filter out just the keys you want, here’s some sample code:

keys = ['available', 'comments', 'comments_full', 'reaction_count', 'reactions', 'reactors']
post = {k: v for k,v in post.items() if k in keys}
pprint(post)

Fetching this post takes ~1.81 seconds. Setting "allow_extra_requests": False reduces that by 0.5815s, as it means the scraper doesn’t make a request to https://m.facebook.com/WeedpayOfficial/photos/a.108611961431851/160806839545696/?type=3&source=57&refid=52&__tn__=EH-R. In terms of where the time is spent then:

Got https://m.facebook.com/story.php?story_fbid=160806872879026&id=108596121433435&_rdr in 0.6976s
Got https://m.facebook.com/ufi/reaction/profile/browser/?ft_ent_identifier=160806872879026 in 0.3653s

So time to get the post (0.6976) + time to get reactions (0.3653) = total (1.0629s). Processing only takes ~137ms. This is neglible, compared to the time taken to make the requests.

Yes, you can pass a dict to set_cookies.

1reaction
neon-ninjacommented, Sep 30, 2021

You will need to pass cookies as per the readme for this. You can pass "comments": True to extract comments. ^= means “starts with”, so reaction_profile_browser1 will match as it starts with reaction_profile_browser.

The code:

set_cookies("cookies.json")
post = next(get_posts(post_urls=["160806872879026"], options={"reactors": True, "comments": True}))
pprint(post)

outputs:

{'available': True,
 'comments': 3,
 'comments_full': [{'comment_id': '160819259544454',
                    'comment_image': None,
                    'comment_reaction_count': None,
                    'comment_reactions': None,
                    'comment_reactors': None,
                    'comment_text': 'grande iniziativa per la moneta!',
                    'comment_time': datetime.datetime(2021, 9, 17, 0, 0),
                    'comment_url': 'https://facebook.com/160819259544454',
                    'commenter_id': '100039121693048',
                    'commenter_meta': None,
                    'commenter_name': 'Damien Massobrio',
                    'commenter_url': 'https://facebook.com/damien.massobrio?fref=nf&rc=p&refid=52&__tn__=R',
                    'replies': []},
                   {'comment_id': '160882329538147',
                    'comment_image': None,
                    'comment_reaction_count': None,
                    'comment_reactions': None,
                    'comment_reactors': None,
                    'comment_text': 'Grandi! 🤩',
                    'comment_time': datetime.datetime(2021, 9, 17, 0, 0),
                    'comment_url': 'https://facebook.com/160882329538147',
                    'commenter_id': '624256272',
                    'commenter_meta': None,
                    'commenter_name': 'Francesco Corfiati',
                    'commenter_url': 'https://facebook.com/netquik?fref=nf&rc=p&refid=52&__tn__=R',
                    'replies': []},
                   {'comment_id': '161355069490873',
                    'comment_image': None,
                    'comment_reaction_count': None,
                    'comment_reactions': None,
                    'comment_reactors': None,
                    'comment_text': 'Ordinato 😍',
                    'comment_time': datetime.datetime(2021, 9, 25, 0, 0),
                    'comment_url': 'https://facebook.com/161355069490873',
                    'commenter_id': '100001725824126',
                    'commenter_meta': None,
                    'commenter_name': 'Patrik Swinicki',
                    'commenter_url': 'https://facebook.com/patrik.swinicki?fref=nf&rc=p&refid=52&__tn__=R',
                    'replies': []}],
 'factcheck': None,
 'fetched_time': datetime.datetime(2021, 10, 1, 9, 15, 4, 536600),
 'image': 'https://scontent.fakl8-1.fna.fbcdn.net/v/t1.6435-9/fr/cp0/e15/q65/242906631_160806846212362_2150939329410152028_n.jpg?_nc_cat=108&ccb=1-5&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_ohc=27ULotX9Y2wAX_HkgOW&_nc_ht=scontent.fakl8-1.fna&oh=c7fcdca7d6fb202a64d5fc6723c858cb&oe=617B6412',
 'image_id': '160806839545696',
 'image_ids': ['160806839545696'],
 'image_lowquality': 'https://scontent.fakl8-1.fna.fbcdn.net/v/t1.6435-9/cp0/e15/q65/p640x640/242906631_160806846212362_2150939329410152028_n.jpg?_nc_cat=108&ccb=1-5&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_ohc=27ULotX9Y2wAX_HkgOW&_nc_ht=scontent.fakl8-1.fna&oh=ddf9c5cfbf5968248ea91477eebecbdb&oe=617BE879',
 'images': ['https://scontent.fakl8-1.fna.fbcdn.net/v/t1.6435-9/fr/cp0/e15/q65/242906631_160806846212362_2150939329410152028_n.jpg?_nc_cat=108&ccb=1-5&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_ohc=27ULotX9Y2wAX_HkgOW&_nc_ht=scontent.fakl8-1.fna&oh=c7fcdca7d6fb202a64d5fc6723c858cb&oe=617B6412'],
 'images_description': ["May be an image of text that says 'W Weed Pay LIMITED "
                        'EDITION FRUIT ฟ HAZE Weed Pay Fruit haze '
                        'inflorescences grown in greenhouse with sweet and '
                        'delicate aroma with notes of exoticfrui fruit with '
                        'strong hint ofmango. It has deep dark green color '
                        'appearance. W Weed ADMASTER #madmaster cbd '
                        'www.madmaster.it Scansion QRcode tramiteph wallet. '
                        "SHOP NOW! f Iam'"],
 'images_lowquality': ['https://scontent.fakl8-1.fna.fbcdn.net/v/t1.6435-9/cp0/e15/q65/p640x640/242906631_160806846212362_2150939329410152028_n.jpg?_nc_cat=108&ccb=1-5&_nc_sid=110474&efg=eyJpIjoidCJ9&_nc_ohc=27ULotX9Y2wAX_HkgOW&_nc_ht=scontent.fakl8-1.fna&oh=ddf9c5cfbf5968248ea91477eebecbdb&oe=617BE879'],
 'images_lowquality_description': ["May be an image of text that says 'W Weed "
                                   'Pay LIMITED EDITION FRUIT ฟ HAZE Weed Pay '
                                   'Fruit haze inflorescences grown in '
                                   'greenhouse with sweet and delicate aroma '
                                   'with notes of exoticfrui fruit with strong '
                                   'hint ofmango. It has deep dark green color '
                                   'appearance. W Weed ADMASTER #madmaster cbd '
                                   'www.madmaster.it Scansion QRcode tramiteph '
                                   "wallet. SHOP NOW! f Iam'"],
 'is_live': False,
 'likes': 15,
 'link': None,
 'links': [],
 'original_request_url': '160806872879026',
 'post_id': 160806872879026,
 'post_text': 'With immense pleasure, the WeedPay team announces the launch of '
              'its first Weedpay-branded Cannabis Light product, the result of '
              'the collaboration with the popular online store Mad Master.\n'
              '\n'
              'Fruit Haze, grown with love in greenhouse, boasts sweet '
              'flavours and excellent potential: a delicate aroma singing '
              'notes of exotic fruit on a marked hint of mango. A haze worthy '
              'of the name. Its tapered, dark green buds are compact with '
              'amber hairs on the trichomes. CBD: 13% THC: 0.5%!!!',
 'post_url': 'https://facebook.com/story.php?story_fbid=160806872879026&id=108596121433435',
 'reaction_count': 15,
 'reactions': {'like': 15},
 'reactors': [{'link': 'https://facebook.com/nikolov.veliko?fref=pb',
               'name': 'Veliko Nikolov',
               'type': 'like'},
              {'link': 'https://facebook.com/damien.massobrio?fref=pb',
               'name': 'Damien Massobrio',
               'type': 'like'},
              {'link': 'https://facebook.com/profile.php?id=100006242988101&fref=pb',
               'name': 'Riccardo Del Chin',
               'type': 'like'},
              {'link': 'https://facebook.com/tony.laterza.5?fref=pb',
               'name': 'Antonio Laterza',
               'type': 'like'},
              {'link': 'https://facebook.com/patrik.swinicki?fref=pb',
               'name': 'Patrik Swinicki',
               'type': 'like'},
              {'link': 'https://facebook.com/tiziano.simoli.5?fref=pb',
               'name': 'Tiziano Simoli',
               'type': 'like'},
              {'link': 'https://facebook.com/salvatore.divincenzo.10?fref=pb',
               'name': 'Salvatore Di Vincenzo',
               'type': 'like'},
              {'link': 'https://facebook.com/nicolas.mincuzzi?fref=pb',
               'name': 'Nicolas Mincuzzi',
               'type': 'like'},
              {'link': 'https://facebook.com/stefano.baggio.9?fref=pb',
               'name': 'Stefano Baggio',
               'type': 'like'},
              {'link': 'https://facebook.com/zagomorenojack?fref=pb',
               'name': 'Zago Moreno',
               'type': 'like'},
              {'link': 'https://facebook.com/pirozzolo.marco?fref=pb',
               'name': 'Pirozzolo Marco',
               'type': 'like'},
              {'link': 'https://facebook.com/claudio.aragona1?fref=pb',
               'name': 'Claudio Aragona',
               'type': 'like'},
              {'link': 'https://facebook.com/andrea.scardacchi?fref=pb',
               'name': 'Andrea Scardacchi',
               'type': 'like'},
              {'link': 'https://facebook.com/fdacunzo?fref=pb',
               'name': "Francesco D'acunzo",
               'type': 'like'},
              {'link': 'https://facebook.com/netquik?fref=pb',
               'name': 'Francesco Corfiati',
               'type': 'like'}],
 'shared_post_id': None,
 'shared_post_url': None,
 'shared_text': '',
 'shared_time': None,
 'shared_user_id': None,
 'shared_username': None,
 'shares': 0,
 'text': 'With immense pleasure, the WeedPay team announces the launch of its '
         'first Weedpay-branded Cannabis Light product, the result of the '
         'collaboration with the popular online store Mad Master.\n'
         '\n'
         'Fruit Haze, grown with love in greenhouse, boasts sweet flavours and '
         'excellent potential: a delicate aroma singing notes of exotic fruit '
         'on a marked hint of mango. A haze worthy of the name. Its tapered, '
         'dark green buds are compact with amber hairs on the trichomes. CBD: '
         '13% THC: 0.5%!!!',
 'time': datetime.datetime(2021, 9, 25, 4, 1),
 'timestamp': None,
 'user_id': '108596121433435',
 'user_url': 'https://facebook.com/WeedpayOfficial/?refid=52&__tn__=C-R',
 'username': 'WeedPay 0fficial',
 'video': None,
 'video_duration_seconds': None,
 'video_height': None,
 'video_id': None,
 'video_quality': None,
 'video_size_MB': None,
 'video_thumbnail': None,
 'video_watches': None,
 'video_width': None,
 'w3_fb_url': 'https://www.facebook.com/story.php?story_fbid=160806872879026&id=108596121433435',
 'was_live': False,
 'with': None}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Flux not subscribing in Spring 5 reactor - Stack Overflow
Short Answer. subscribe does not block current thread, that means app main thread can complete earlier than Flux emits any element.
Read more >
NRC Altering Population Siting Guidance for Advanced ...
The new approach acknowledges the need to reevaluate the siting criteria for advanced reactor designs that employ enhanced safety attributes.
Read more >
Reactor 3 Reference Guide
Performing Post-execution Assertions with StepVerifier; 6.4. ... Reactor 3 does not officially support or target Android (consider using ...
Read more >
NRC approved a new approach that allows siting advanced ...
Commissioner Baran disapproved the recommended approach stating that “unlike existing light-water reactors, advanced reactors do not have ...
Read more >
What is nuclear fusion, and why Tuesday's announcement ...
Its lasers are not capable of constantly firing — a prerequisite for scaling fusion reactors up into commercial power plants. The DOE is...
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