在没有api密钥的情况下抓取facebook的公共页面。
facebook-scraper的Python项目详细描述
Facebook刮板
在没有api密钥的情况下抓取facebook的公共页面。灵感来自twitter-scraper。
安装
pip install facebook-scraper
用法
>>>fromfacebook_scraperimportget_posts>>>forpostinget_posts('nintendo',pages=1):...print(post['text'][:50])...ThefinalstepontheroadtotheSuperSmashBrosWe’reheadedtoPAXEast3/28-3/31withnewgames
后置示例
{'post_id':'2257188721032235','text':'Don’t let this diminutive version of the Hero of Time fool you, ''Young Link is just as heroic as his fully grown version! Young Link ''joins the Super Smash Bros. series of amiibo figures!','time':datetime.datetime(2019,4,29,12,0,1),'image':'https://scontent.flim16-1.fna.fbcdn.net''/v/t1.0-0/cp0/e15/q65/p320x320''/58680860_2257182054366235_1985558733786185728_n.jpg''?_nc_cat=1&_nc_ht=scontent.flim16-1.fna''&oh=31b0ba32ec7886e95a5478c479ba1d38&oe=5D6CDEE4','likes':2036,'comments':214,'shares':0,'post_url':'https://m.facebook.com/story.php''?story_fbid=2257188721032235&id=119240841493711'}
注释
- 无法保证每个字段都将被提取(它们可能是
None
)。 - 股票目前似乎不起作用。