-
Notifications
You must be signed in to change notification settings - Fork 640
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
alternative method for extracting post reactions #194
Merged
kevinzg
merged 3 commits into
kevinzg:master
from
neon-ninja:alternative_extract_reactions
Apr 11, 2021
Merged
alternative method for extracting post reactions #194
kevinzg
merged 3 commits into
kevinzg:master
from
neon-ninja:alternative_extract_reactions
Apr 11, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Apr 1, 2021
This PR has now been extended to allow for extraction of people reacting to a given post. Usage: posts = list(get_posts(post_urls=["https://m.facebook.com/story.php?story_fbid=1931709990319458&id=285708024919671"], cookies="cookies.txt", options={"reactors":True}, timeout=15))
pprint.pprint(posts) output: [{'available': True,
'comments': 0,
'comments_full': None,
'factcheck': None,
'fetched_time': datetime.datetime(2021, 4, 8, 11, 15, 22, 542354),
'image': 'https://scontent.fakl1-3.fna.fbcdn.net/v/t1.6435-9/fr/cp0/e15/q65/167519232_1931709876986136_319473773610266922_n.jpg?_nc_cat=107&ccb=1-3&_nc_sid=8024bb&efg=eyJpIjoidCJ9&_nc_ohc=_sgSzf52DosAX9ooHo2&_nc_ht=scontent.fakl1-3.fna&tp=14&oh=c61b5ffbf1ae8f595e982567c7ef67da&oe=6095C226',
'images': ['https://scontent.fakl1-3.fna.fbcdn.net/v/t1.6435-9/fr/cp0/e15/q65/167519232_1931709876986136_319473773610266922_n.jpg?_nc_cat=107&ccb=1-3&_nc_sid=8024bb&efg=eyJpIjoidCJ9&_nc_ohc=_sgSzf52DosAX9ooHo2&_nc_ht=scontent.fakl1-3.fna&tp=14&oh=c61b5ffbf1ae8f595e982567c7ef67da&oe=6095C226'],
'is_live': False,
'likes': 21,
'link': 'https://www.nintendo.com.au/the-big-multiplayer-sale?fbclid=IwAR31RzXRYSw92nc_eB3Qkz0gmg3TFfLoS1ZbP8UxX9cTLhFjRsGdp261VvE',
'post_id': '1931709990319458',
'post_text': 'Challenge friends and family with a selection of online '
'multiplayer games, now up to 75% off as part of The Big '
'Multiplayer Sale!\n'
'\n'
'See highlights: '
'https://www.nintendo.com.au/the-big-multiplayer-sale',
'post_url': 'https://facebook.com/story.php?story_fbid=1931709990319458&id=285708024919671',
'reactions': {'like': 21, 'love': 5, 'wow': 2},
'reactors': [{'link': 'https://facebook.com/cameron.henderson.370177?fref=pb',
'name': 'Cameron Henderson',
'type': 'Like'},
{'link': 'https://facebook.com/zeusshomaly23?fref=pb',
'name': 'Zeus Shomaly',
'type': 'Like'},
{'link': 'https://facebook.com/leon.walty.1?fref=pb',
'name': 'Leroy Walty',
'type': 'Like'},
{'link': 'https://facebook.com/adam.sutherland.7549?fref=pb',
'name': 'Adam Sutherland',
'type': 'Like'},
{'link': 'https://facebook.com/profile.php?id=100011574431906&fref=pb',
'name': 'Jasdeep Singh Rathor',
'type': 'Like'},
{'link': 'https://facebook.com/nicholas.kakolyris.5?fref=pb',
'name': 'Nicholas Kakolyris',
'type': 'Love'},
{'link': 'https://facebook.com/andrew.mcvicar.79?fref=pb',
'name': 'Andrew McVicar',
'type': 'Love'},
{'link': 'https://facebook.com/jack.coventry.79?fref=pb',
'name': 'Jack Coventry',
'type': 'Like'},
{'link': 'https://facebook.com/gail.roberts.7737?fref=pb',
'name': 'Gail Roberts',
'type': 'Like'},
{'link': 'https://facebook.com/tynan.hicks?fref=pb',
'name': 'Tynan Hicks',
'type': 'Like'},
{'link': 'https://facebook.com/WinderHylian?fref=pb',
'name': 'Manuel Winder',
'type': 'Like'},
{'link': 'https://facebook.com/eric.apostol.3?fref=pb',
'name': 'Eric Apostol',
'type': 'Like'},
{'link': 'https://facebook.com/emily.owens.737?fref=pb',
'name': 'Emily Owens',
'type': 'Love'},
{'link': 'https://facebook.com/scott.gordon.56863?fref=pb',
'name': 'Scott Gordon',
'type': 'Like'},
{'link': 'https://facebook.com/rodney.hockey?fref=pb',
'name': 'Rodney Hockey',
'type': 'Like'},
{'link': 'https://facebook.com/Z.Landers94?fref=pb',
'name': 'Zachary Landers',
'type': 'Angry'},
{'link': 'https://facebook.com/Mr.TimAir?fref=pb',
'name': 'Jimmy Archer',
'type': 'Like'},
{'link': 'https://facebook.com/kaylahstreet?fref=pb',
'name': 'Kaylah Confessore',
'type': 'Like'},
{'link': 'https://facebook.com/ashley.mclean.71?fref=pb',
'name': 'Ashley Mclean',
'type': 'Love'},
{'link': 'https://facebook.com/profile.php?id=1018077487&fref=pb',
'name': 'Michael Smith',
'type': 'Like'},
{'link': 'https://facebook.com/brandon.ladner?fref=pb',
'name': 'Brandon Ladner',
'type': 'Love'},
{'link': 'https://facebook.com/jeames.granger?fref=pb',
'name': 'Jeames Granger',
'type': 'Wow'},
{'link': 'https://facebook.com/dodge.jorge?fref=pb',
'name': 'Dodge Jorge',
'type': 'Like'},
{'link': 'https://facebook.com/jeremiah.galawyn?fref=pb',
'name': 'Jeremiah Alexander Galawyn',
'type': 'Like'},
{'link': 'https://facebook.com/TheDemons?fref=pb',
'name': 'Giovanni Maglione',
'type': 'Like'},
{'link': 'https://facebook.com/pete.mcmanus2?fref=pb',
'name': 'Pete McManus',
'type': 'Like'},
{'link': 'https://facebook.com/sarahrusso1410?fref=pb',
'name': 'Sarah E. Russo',
'type': 'Like'},
{'link': 'https://facebook.com/tomsesselmann?fref=pb',
'name': 'Thomas Sesselmann',
'type': 'Wow'},
{'link': 'https://facebook.com/rod.lord?fref=pb',
'name': 'Rod Lord',
'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': 'Challenge friends and family with a selection of online multiplayer '
'games, now up to 75% off as part of The Big Multiplayer Sale!\n'
'\n'
'See highlights: '
'https://www.nintendo.com.au/the-big-multiplayer-sale',
'time': datetime.datetime(2021, 4, 6, 14, 34),
'user_id': '285708024919671',
'username': 'Nintendo',
'video': None,
'video_id': None,
'video_thumbnail': None}] |
This was referenced Apr 12, 2021
Hi, this seems not to be working anymore... |
@JosephManalo please follow the issue template - #273 |
Upon trying again, my mistake. There are no issues with this. I just forgot to put the cookies="cookies.txt" on my code, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an alternative method for extracting post reactions, using m.facebook. If this fails for any reason, the existing w3 method is also attempted. Note that this seems more reliable if cookies are passed.
Test code:
Sample output: