facebook-post-scraper icon indicating copy to clipboard operation
facebook-post-scraper copied to clipboard

Facebook New Design

Open krawez opened this issue 4 years ago • 2 comments

Facebook has updated its layout, so all the parsing has to be reviewed :(

krawez avatar Sep 21 '20 11:09 krawez

Did you manage to fix it ? Thank you

othmanechentouf avatar Sep 21 '20 16:09 othmanechentouf

Here are a couple html codes for parsing I found so far (I am using Selenium, but can easily be updated to BeatifulSoup):

  • Posts: driver.find_elements_by_xpath("//div[@data-testid='Keycommand_wrapper_feed_story']/div[@data-testid='Keycommand_wrapper']/div[@role='article']"

  • Post_text: post.find_element(By.CSS_SELECTOR,"div[data-ad-comet-preview='message']")

  • Reactions (Top 3): reactions = post.find_element_by_css_selector("span[role='toolbar']").find_elements_by_css_selector("div[role='button']") for reaction in reactions: reaction = reaction.get_attribute("aria-label")

I am struggling to extract the date - if someone has the solution - would love to hear!

krawez avatar Sep 22 '20 09:09 krawez