How Do I Scrape The About Section Of A Facebook Page?
How do I scrape pages from the Facebook About section. Can I use Facebook Graph API or should I use a Python web-scraping library like Scrappy of Beautiful Soup?
Solution 1:
The Facebook Graph API is for "apps to read and write to the Facebook social graph" so you cannot use it in this case. Instead, you should use a Python scraping-libary like beautifulsoup.
An example of scraping the Facebook About Page for the organizations mission statement might look like this:
from bs4 import BeautifulSoup
import requests
response = requests.get("https://www.facebook.com/pg/officialstackoverflow/about/?ref=page_internal")
html = response.content
soup = BeautifulSoup(html, "html")
mission_statement = soup.find('div', attrs={'class': '_3-8w'})
print(mission_statement.text)
> To make the internet a better place and be the best site to find expert answers to your programming questions.
Post a Comment for "How Do I Scrape The About Section Of A Facebook Page?"