2017-10-22 6 views
-3

Facebook About sectionのページを削り取るにはどうすればいいですか? Facebook Graph APIを使用できますか?ScrappyのようなPython Webスクレイピングライブラリを使用する必要がありますか?Beautiful SoupFacebookページのaboutセクションをどうやって削りますか?

+0

スクレイピングはFacebookを利用して許可されていません。あなたはグラフのAPIを使用する必要があります。 – luschn

答えて

1

Facebook Graph APIは"apps to read and write to the Facebook social graph"のため、この場合は使用できません。代わりに、beautifulsoupのようなPythonスクレイピングライブラリを使用する必要があります。

組織のミッションステートメントのためのページについてのFacebookをこするの例は次のようになります。

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. 
関連する問題