How to Scrape Facebook Page Posts and Comments to Excel (with Python)


In this tutorial, I will show you how to easily scrape any public Facebook Page or Group posts and comments to Excel spreadsheet using Facebook scraper tool(ready-made Python Scripts).No programming background is required but might be helpful.Just follow the easy steps.

In a hurry? Sign up for Quintly (Free 14-Day Trial For All Packages – NO CREDIT CARD NEEDED) and Scrape Facebook Page Posts Data to Excel in no time!

Once you feed in the required information at the command line prompt (Facebook access token and Page name or Group ID) and command it to run it will automatically download the following data from the Facebook Page or Group to Excel spreadsheet:

  • All the Facebook statuses or posts of the page or group
  • The number of likes,shares and comments for each post
  • The number of Facebook reactions (Like,Love,Haha,Wow,Sad,Angry) for each post
  • Each post status type,link and published date
  • All the comments with comment’s author and number of likes for each comment(if any),published date

Below images show Facebook statuses/Posts extracted from Hillary Clinton Facebook page using the scripts:

Facebook page statuses data into excel part 1Facebook page statuses data into excel part 2

Below image shows Comments extracted from Donald Trump Facebook page using the scripts:

Facebook page statuses comments into excel

Let’s get started.

Step 1:Install Python 2

Since we will be using Python scripts to extract data from the Facebook page then we need to install Python interpreter to execute them.Installation instructions will vary depending on whether you are using Mac OS X,Linux/UNIX or Windows.I will cover the installation in brief.But it is very easy and there is a lot of detailed instructions online incase you can’t follow my brief explanation.If you have Python already installed on your system you can skip this step.

For Windows computers

If you don’t have Python 2 on your system follow below steps:

    1. Download Python 2.7.x and install it (Don’t install Python 3 the scripts won’t work).
    2. After Python is installed.Search PowerShell from the Start menu and press Enter to run it.
      Windows Powershell
    3. In the PowerShell window type python (in lower case) and hit RETURN/ENTER key as shown in the image below:
      PowerShell running python
    4. After hitting return the version of Python which is installed on your system will show.In my case, I have Python 2.7.12 installed on my Windows.
      Windows Powershell running Python 2.7.12
    5. If it says “Python is not recognised” which will, fortunately, happen if you run Python for the first time on windows.Then in PowerShell copy and paste below values,Close the PowerShell then start it again to make sure Python now runs and repeat Step 3.                                                 [Environment]::SetEnvironmentVariable(“Path”, “$env:Path;C:\Python27”, “User”)
    6. Type quit(), Enter, and get out of python.You should be back at a prompt similar to what you had before you typed python. Then move to Step 2.
      PowerShell quitting Python

For Mac OS X and Linux/UNIX computers

If you are using Mac OS X computers Python 2 is already pre-installed.Also, most Linux/UNIX systems have Python 2 pre-installed.If not installed you can install it from command line by writing brew install python but make sure you have brew installed on your MAC.

install python on mac os x

  1. If you are using Mac OS X or Linux system search for Terminal program,once it is open type python (in lower case) and hit RETURN/ENTER key as shown in the image below:Ubuntu terminal
  2. After hitting return the version of Python which is installed on your system will show.In my case I have Python 2.7.6 installed.If it doesn’t show you anything then you have to go to Python Website and download Python 2.7.x (Don’t install Python 3 the scripts won’t work)Ubuntu terminal running python
  3. Type quit(), Enter, and get out of python.You should be back at a prompt similar to what you had before you typed python. Then move to Step 2.Ubuntu terminal quitting python

Step 2:Get access token from the Facebook Graph API explorer

The Python scripts will access data from Facebook using the Facebook Graph API.You will need to fill in the access token so that the scripts are authenticated to extract data through the API.

You get the access token by visiting Facebook Graph Explorer,then sign in with your Facebook account(any).Get the access token as shown in the image below and save it somewhere as we will need it in later steps.

Graph API access token

Normally the access token is valid for 2 hours before it can expire.If it expires you can click “Get Token” to get a new one.

Access token expiration time

An access token which never expires

You can create an access token which never expires by concatenating Facebook App ID and App Secret with a pipe.

To get Facebook App ID and App Secret, you must create a Facebook for Developers account. Don’t worry it so easy than it sounds. Click this link and follow the wizard. After setting up your app then go to your  dashboard>settings>basic then click show App secret.

facebook app id and app secret

Your access token will be your app ID|app secret .Don’t forget the pipe “|” between the app ID and app secret. For example, my never expiring access token will be 1179322318819014|a5axxxxxxxxxxxxxxx.

Step 3:Getting Facebook Page name or Group ID

You can get a correct page name from the URL of the page as shown in the image below and save it somewhere as we will need the name later to scrape Facebook Page posts.

getting facebook page name

If you wish to scrape Facebook Open Groups then you need to get a numeric group ID and not a group name.

To get a numeric group ID,navigate to the Open group you wish to scrape and “view source”.To view source Press Ctrl + U (Windows, Linux) or Command + U (Mac) on the group page and search for entity_id  or fb://group either one will have a number to that field.Copy the number and save it somewhere.

For example, the group ID of bigdatastatistics is 484618291590939.


Step 4:Scraping Facebook Page posts data such Post statutes,Reactions count,Likes count,Shares count,comments count

Download script and save it somewhere on your computer.Put the script inside a folder.This is the same folder which the script will save the Excel spreadsheet after scraping.

Now from PowerShell for Windows and Terminal program for Mac OS X/Linux/UNIX navigate and open this folder containing your script.

For example, my script is saved inside “Scraping folder” on my desktop folder

Below is how I accessed the folder from the PowerShell

Accessing Folder from PowerShell

For example, my script saved inside “scraping  folder” on the home directory on Ubuntu which will be similar to MAC OS X/Linux/UNIX

Ubuntu accessing Python script

Below is how I accessed the folder from Ubuntu which will be similar to MAC OS X/Linux/UNIX

Ubuntu accessing the scraping folder

Now the interesting part is to run the script make sure the access token and Facebook page name or Group ID are with you as they will be the inputs for the scripts.

On the Windows PowerShell and Terminal program type python  (make sure python is lower case).The script will start running and it will ask you to paste the Facebook Page ID.Paste it there and click ENTER/RETURN KEY.Then it will ask you to paste the access token.Paste it there and click ENTER/RETURN KEY.Make sure not to paste any extra whitespace as it might cause some error.

For example, I was scraping data from the Facebook Page DiamondPlatnumz255 and my access token started with EAACEdE(Truncated).It took only 5 minutes to scrape 3033 posts statuses as shown below:

scraping facebook posts python script

When the script finishes running it will give you a final report showing how many statuses were processed and how much time it took.

scraping facebook page posts python script running

The Statuses will be saved in the folder where your script resides as a CSV file.The CSV format can be opened by MS Excel program in Windows.

scraped Facebook statuses CSV

The CSV will have the following columns of data “status_id”, “status_message”, “link_name”, “status_type”,”status_link”,”permalink_url”, “status_published”, “num_reactions”, “num_comments”, “num_shares”, “num_likes”, “num_loves”,”num_wows”, “num_hahas”, “num_sads”, “num_angrys”

Scraped Facebook posts

Sometimes you might encounter some errors especially (HTTP Error 400:Bad Request) if the access token is expired.The script will keep on retrying.To terminate the script hit CTRL+C.

HTTP Errror 400 Bad Request

If you encounter the above error.Check to see if the access token is not expired.If it is expired you can get a new one by refreshing the Graph API explorer or create a never expiring access token.

Access token expiration time

Step 5:Scraping Facebook Group posts data such as Post statutes,Reactions count,Likes count,Shares count,comments count

Scraping Facebook Open Public groups is similar to scraping Facebook pages.Make sure you have the Group numeric ID as explained in Step 3 and access token as explained in Step 2.Then run this Python script as explained in Step 4.

Below is an output after scraping a Public Group bigdatastatistics with a Group numeric ID of 484618291590939.

The output CSV will have these columns of data “status_id”,”status_message”, “status_author”,”link_name”, “status_type”, “status_link”,”permalink_url”,”status_published”, “num_reactions”, “num_comments”,”num_shares”, “num_likes”, “num_loves”, “num_wows”,”num_hahas”, “num_sads”, “num_angrys

scraping facebook groups

Scraping facebook group posts

Step 6:Downloading Facebook Pages and Groups posts comments to Excel

To scrape all the user comments from Facebook pages or groups posts make sure the output CSVs you got from previous steps exist because the python script will read status_id from the CSV files obtained in the previous steps and use the data to generate comments.

Scraping facebook comments

Download the script run it and it will ask you for the Facebook Page name or Group ID>Put the same name or group ID as you used in the previous steps,then put the access token.

running python script to scrape comments

The output CSV file will have these columns of data “comment_id”, “status_id”, “parent_id”, “comment_message”,”comment_author”,”comment_published”, “comment_likes”

Facebook scraped comments

The output CSV file includes a column with status_id.The status_id column is also included in the output we got while scraping Facebook page or group in the previous steps.So you can map the comment to the original Post with a JOIN or VLOOKUP, and also a parent_id if the comment is a reply to another comment.

Keep in mind that active Facebook pages or Groups have a lot of comments.The throughput of this script is approximately 87k comments/hour.

Step 7: Scraping single post comments and names of people who like the post: Perfect for running Facebook contests

In step 6, I showed you how to extract comments from all the statuses of a Facebook page but in this step, I will show you how to export comments to CSV for a single post of your choice.

facebook single post with status id

Open pagename_facebook_statuses.csv generated in step 5, remove all the rows with the posts you don’t want to get comments from and keep only the row with the post you want to get comments from.Then run again the . The comments for a single post will be saved in CSV.

scraping facebook single post comments csv

What if you want to get the names of the people who like that post?

Copy the post’s status_id somewhere then run this script. The script will ask you for a post status_id paste the post’s status id. For my case the status_id is 153080620724_10157807281620725 . See how I pasted below.

scraping single post likes with python

You will get a CSV that looks like below.

facebook names of people who like a post

Do you want a Graphical User Interface for scraping Facebook Profiles? Sign up for Quintly (Free 14-Day Trial For All Packages – NO CREDIT CARD NEEDED) and Scrape Facebook Page Posts Data to Excel in no time!

Conclusion and recommendations

I have tried to explain clearly the steps with images so that even if you are not coming from programming background you will be able to scrape data from Facebook.Incase you have any question please leave a comment below or you can contact me through the contact form.

You might also be interested in How to extract Twitter tweets data and followers to Excel

If you are not familiar with Python or have an experience in other programming languages and would like to learn Python I recommend you read this Python book. Python is an easy to learn programming language.

Click Here to Leave a Comment Below 90 comments
Farooq - September 16, 2016

Good and Time saver Script

John - September 19, 2016

Hey Paulo, great post!

The script seems to work but it’s only gathering the first 10 or 11 posts from a page and no posts from a public group. Tried page names and entity_IDs. Is there some time limit to the

Hope you can answer my question.


    Paulo - September 23, 2016

    Hi John,
    There is no limit.You can share with me the page name through the contact form and I will check it for you.

John - September 19, 2016

Hey Paulo, awesome post!

Don’t know if my previous comment posted but I had a look at your code (thanks for nice commenting btw) and it seems like the “while has_next_page:” isn’t working. I’m also not getting an output processed (print “%s Statuses Processed: %s”) and it only runs for a second.

Could it be my internet connection is too slow for facebook to send a “has next page”?

Anyway thanks again for your guidance 🙂


    Paulo - September 23, 2016

    Hi John,
    Please share with me the page name through the contact form and I will check it for you.

dhaval - September 24, 2016

hello, this is very good post about facebook scraping. i want to know that, can i scrap comments of only one post i want? if yes, then how???
plz replay
thank you

    Paulo - October 2, 2016

    Hi Dhaval,

    You can select the posts you want to scrape comments from.
    Actually what the “” does is reading posts “status_id” from the CSV generated from “” then scraping their respective comments.
    You can limit the posts you want to extract comments from by editing the CSV generated by “”.Keep or add only the status_ids of your interest.

    Let me know if it helps.

Melisa - September 30, 2016

Hi! Thanks for your scritps! They do work! The only problem I got is that I would like to download just a few posts and comments from those post alone, but the script downloads the entire page, wich becomes a problem because after a couple hours I got a error message. Don’t know if it’s because of the token, but even renewing it, it starts to download everything from the last post so it never reaches the post i’m trying to scrap. Is it any way I could select the posts I want to scrap, rather than the whole thing?
Thank you very much and sorry in advance for my lousy english lol

    Paulo - October 2, 2016

    Hi Melisa,
    You can select the posts you want to scrape comments from.
    Actually what the “” does is reading posts “status_id” from the CSV generated from “” then scraping their respective comments.
    You can limit the posts you want to extract comments from by editing the CSV generated by “”.Keep or add only the status_ids of your interest.

    Let me know if it helps.

      Fernanda - November 4, 2016

      Hi, Paulo.
      I’m working with Melisa with this. Thank you for your help!
      We want to know if it’s possible to update the CSV without downloading all the posts of the fan page, especially when we have to analyse a fan page with a long history.

Becky - October 3, 2016


Thanks so much for this tutorial! It was really helpful.

Joy - October 9, 2016

Thank you so much for your clear instructions! I followed the steps but the csv files contain no data, only the headers. Would truly appreciate if you can help me with it. Here’s the facebook page I wanted to scrape comments to excel: Thanks so much!

    Paulo - October 9, 2016

    Hi Joy,
    I can scrape comments from the page.No issue with the script or the page.

    Did you run the “” script for the page?The reason I ask this is because the “” script reads the output CSV(For your case FreshEmpire_facebook_statuses.csv) generated by “” to generate comments.

    Tip:To generate comments for specific post(s) you can keep only the rows of your interest and delete the rest (For your case FreshEmpire_facebook_statuses.csv) then run “”

    Let me know if it helps.

Eg - October 11, 2016

Hi awesome tutorial really liked it used it to scrape some pages especially insightful, the status-id and parent_id for linking comments to articles.

I just had a question if you have any advice how I should go about analyzing the data for statistical purposes .I have now like 1000’s of comments not millions but 1000’s anything in python you recommend in particular. Or in databases someone told me about apache spark and casandra. Any advice would be greatly appreciated. Todo some statistics tests make some graphs kinda like what minimaxir did on his github page.

    Paulo - October 13, 2016

    Hi Eg,
    You can do sentiment analysis and opinion mining with the comments using NLTK library and plot graphs using Plotly.

      eg - November 7, 2016

      Hi Paulo,

      Thanks for your response I want to flag expletive facebook comments I wondered if you know of any library which would help especially with misspellings of words etc which bypass most checkers
      Something like nltk

        Paulo - November 9, 2016

        I don’t know of any library. But I think it is supposed to be there.
        You can build your own database as well.

Mohamed - October 14, 2016

Hi Paulo

How can i download facebook page post for particular time period?

Shiny - October 19, 2016

Sir, How will I be able to see the csv file if I run the above code in python

    Paulo - October 20, 2016

    Hi Shiny,
    The CSV will be generated in the same folder where your script is located.

kb - October 22, 2016

This was great, thanks so much. Worked so well.

jiri - October 26, 2016

Hello, thanks for this script and tutorial. Do you think it would be possible to set the scraper to scrape more than one page, like it would load page names from text file thne scrape one at a time? I have some programming knowledge, but none with python.

    Paulo - October 26, 2016

    Hi Jiri,
    It is possible to do that.You need to tweak the code to read page names from text file.Also you need to get a permanent access token (an app access token) which never expires.

bruss - October 27, 2016

hello Paulo

How i can get user email and name and phone with Facebook ?

eg - November 2, 2016

Hi , I run the script but for certain facebook websites it gives me error

Traceback (most recent call last):
File “”, line 174, in
scrapeFacebookPageFeedComments(file_id, access_token)
File “”, line 103, in scrapeFacebookPageFeedComments
with open(‘%s_facebook_statuses.csv’ % file_id, ‘rb’) as csvfile:
IOError: [Errno 2] No such file or directory: ‘MAHER_facebook_statuses.csv’

However other sites it works Im not sure if I have the wrong username for the page like newyorktimes I just copied the top part like I did for CNN and wallstreetJournal but only this some it gives error if you have any thoughts please let me know

    Paulo - November 3, 2016

    Hi Eg,
    Did you run the before the
    The generate a CSV file which uses.

      eg - November 7, 2016

      Yeah perfect thank you very much. I was running them in the wrong order

Mohamed - November 3, 2016

Dear sir
I downloaded post in tamil language. but it shows only special characters. How i can download posts in Tamil language?

Aswitha - November 11, 2016

Hi Paul,

What will be the syntax if I wish to extract the comments only for a specific date interval?

This does not work. It throws an error of bad request:
base = “”
node = “/%s/comments” % status_id
fields = “?fields=id,message,like_count,created_time,comments,from&until=2016-06-30&since=2016-04-01,attachment”
parameters = “&order=chronological&limit=%s&access_token=%s” % \
(num_comments, access_token)
url = base + node + fields + parameters

    Paulo - November 11, 2016

    Hi Aswitha,

    I have updated the tutorial to show you how to extract comments for a single post or certain posts (within a specific time interval).
    After running the script and generated the pagename_facebook_statuses.csv remove all the posts you don’t want to get comments from and leave only the ones you want to get comments from and run again. retrieves comments for whatever posts it finds on pagename_facebook_statuses.csv by reading the status_id column. No need to mess up with the codes. Just play with the status_id column.

    Let me know if it works!

Amir - November 16, 2016

It works like magic. Thank you!
May I ask if there is a tool to convert the facebook IDs to facebook emails?

Thank you 🙂

Raji - November 25, 2016


Would it be possible to include the author ID for the comments script!

Carl - November 30, 2016

Hi paulo,
when i execute post.spy this error message appears HTTP Error 404: Not Found. Please guide me what to do. thank you!

    Paulo - December 2, 2016

    Hi Carl,
    Make sure your access token is still valid.

Philippe Lewis - December 13, 2016


Such an awesome script!!!

I’m noticing however that while it extracts my own statues/links/videos/notes, it does not extract shared statuses/links/videos/notes from other people. When I look at the activity area in my FB profile, I can see all of these, but not in the CSV that comes out. The python script doesn’t seem to be filtering these, so I’m not sure what might be getting in the way. Thoughts?

Thanks so much!


    Paulo - December 13, 2016

    Hi Philippe,
    The scripts are intended for public pages and groups. You will need other kinds of access token/permission to access other people profiles.

Eva - January 10, 2017

I am a member of a secret group. Do I know of there to save the contents?

    Paulo - January 12, 2017

    Hi Eva,
    There is no way to do it with the API.

William - January 31, 2017

Thank you Paulo for the code, it works wonder.
Can I use the code on people not a group / page?
I tried to but it only gave me 0 status.
I don’t know if this is because the profile permission setting or Facebook really don’t allow it.
If I have to tweak the code, could you please tell me how / give me a clue?
Thank you very much. 🙂

    Paulo - February 1, 2017

    Hi William,
    You can’t use because of the profile permission setting.
    Facebook do allow it but you need to get permission from the second part which makes the whole thing complicated.

      William - February 1, 2017

      Do you know how to ask for the permission?
      I’ve done some research and I think I only found the Graph API Explorer to get the token. I don’t know how to do it.
      Thank you.

        Paulo - February 4, 2017

        That will require more coding than what is covered in the tutorial.

          William - February 17, 2017

          Do you know where can I read some article to ask for the permission? Thank you~

Cien Baurile - January 31, 2017

This is super useful for my thesis. Thank you so much!!! =)))))

Amir - February 4, 2017

Hello i was scraped it. But file excel have error about font. Can you talk to me. What kind of font you use it. Because my group in Viet Nam so when i scrape it have error font ! please have me !
My group i want scrape have id: 364997627165697

    Paulo - February 10, 2017

    Hi Amir,
    The CSV is not displaying correctly non-English characters but if you open with notepad you can see the non-English characters correctly.

    I’m working on the issue will update you if resolved.

Jim - February 10, 2017

I keep getting a 404 “Not found”, even for your site example.

# python
Please Paste Public Page Name:DiamondPlatinum255
Please Paste Your Access Token:Retrying.
HTTP Error 404: Not Found
Error for URL,link,permalink_url,created_time,type,name,id,comments.limit(0).summary(true),shares,reactions.limit(0).summary(true)&limit=100&access_token=EAACEdEose0cBAGuIZBNWHxmqCdhhI260MTlaNKy5qyRkHffdVbjflifWZBhybCTeiZBG5gg0hdrbBBZCYdUVzbGEPCDKw71DzApWwqwZCTvCg83GB9y0kNY2XiUNFWKZCyhenb1t65GiL3lov6g6lxeEO9jM27yJAU6N9NzjF2F87RAb6bZB6sqwAvMZBf1IkmIZD: 2017-02-09 14:56:52.339857Scraping DiamondPlatinum255 Facebook Page: 2017-02-09 14:59:56.432817

    Paulo - February 10, 2017

    Hi Jim,
    Seems like an issue with Facebook server. Myself and other readers have been getting this error on and off recently.

Nubi - February 10, 2017

Thank you so much for your script! I followed the instruction and I could get all the Facebook posts in an excel file. The problem is that the language the Facebook page uses is Arabic and all text written in Arabic were broken. Is there any way that I can scrape Facebook posts written in Arabic? Thanks in advance!

    Paulo - February 10, 2017

    Hi Nubi,
    I’m working on this bug. I will get back to you.

    Paulo - February 11, 2017

    Here is a solution to display non-English Characters.
    1.On a Windows computer, open the CSV file using Notepad.
    2.Click “File > Save As”.
    3.In the dialog window that appears – select “UTF-8” from the “Encoding” field. Then click “Save”.

    4.That’s all! Open this new CSV file using Excel

Silver - February 16, 2017

Hi Paulo,

I see from your reply to an earlier comment that this script will not work on secret Facebook Groups. Is there any way to conveniently extract data from secret Facebook Groups for analysis?


    Paulo - February 17, 2017

    Hi Silver,
    You can use Selenium to automate the infinite scrolling and beautiful soup library or any other library of choice to scrape the html to CSV. It is against Facebook TOS to do this kind of scraping but it is doable.

Minh Nguyen - February 21, 2017

Awesome guide, thank you a lot!

Lesley - February 23, 2017

Hello Paulo, this was incredibly helpful.

Do you know how I can include video length into


Lesley Sim - February 23, 2017

Also, I wonder if you know how to extra video views as well? Thank you for all your help!

Oleg - February 24, 2017

Hi, Paulo,

Thanks for this script and tutorial. I get an HTTP Error 500: Interal Server Error and go to recursion, what me do?

    Paulo - February 24, 2017

    Hi Oleg,

    Try after some time. Hopefully, it will be okay.

Minh Pham - February 28, 2017

Hi Paulo,
Your script is really fantastic,
But I got font error when crawling asian text:
Something like: hy vọng trúng giải
=> How can I convert it to: hy vọng trúng giải or hy vong trung giai
Tks u so much

Minh Pham - February 28, 2017

Hi Paulo,
I read the comment and already fix the font error by notepad encode,
How can I get the user link of the user who comment on post?
Thank you so much,

Nikola Komljenovic - March 10, 2017

Hi Paulo,
This script is great and very helpful!
Is there any way to get visitors posts from public facebook page?

Thank you so much!


    Paulo - March 13, 2017

    Hi Nikola,

    You will need users permission to scrape their posts.

Stephen O'Brien - March 22, 2017

Hi Paulo

I am a student in Mathew Parackal’s Digital Marketing class and we used your guide for the scraping on Facebook posts for selected sites. It worked great and the guide was super useful. However when trying to scrap my own public Facebook page, Http Error 404: Not Found kept coming up. I tried new access tokens but still wouldn’t work. Do you know what the problem could be as I followed the post and it worked for groups but not public profile pages?


    Paulo - March 22, 2017

    Hi Stephen,

    Please send to me your Facebook page through the contact form and I will have a look on your issue.

    Sham - March 27, 2017

    if you want to scrape your Facebook data replace page id as page_id=”me”

Tony - March 30, 2017

Hi Paulo,

2 points:
1. the api works with public group, but will it work with Closed groups which i’m in? i mean, with the api of my own, it should be ok to scrape, but tried it for 1 time, and with “(HTTP Error 400:Bad Request)” only. so doesn’t support the Closed and Secret styles?

2. i test python with the one provided in this post: “For example, the group ID of bigdatastatistics(Public) is 484618291590939”, and with the .csv file generated, then python, but it give me the error prompt: “…”, any insights why?

Thanks for clarification.

    Paulo - April 24, 2017

    Hi Tony,
    1.It doesn’t work with closed group even if you are member there.
    2.It is working fine for me.

Azrul - March 31, 2017

Hi Paulo,

Thank for all of the awesome tutorial as coding samples in this post.
You have made interested to learn more about python programming language.

I have downloaded a few more sample of project coding in github just to get a view of other coding examples.

Is there a new version for these codes.


Upgrade to the python 3xx


    Paulo - April 24, 2017

    Hi Azrul,
    Yes, There are Python 3 codes on Github.

Jason - April 21, 2017

Hey Paulo

Have you or any of your users noticed that FB has changed the format of the 1st page that return json. When I copy and paste direct into – I get an error. So I now paste a URL into which seems to untangle it.

However – when I try the same with next page – the resultant URL no longer contains: ‘\u002528’ and ‘\u002529’. FB seem to have replaced these with ‘%28’ and ‘%29’ that need to replace ‘(‘ and ‘)’.

The resulting URL – even after I’ve cleaned it up – whilst it does return JSON data – doesn’t allow me to reformat it konklone or codebeautify. I have found that works very well, though

Hope this helps


    Paulo - April 24, 2017

    Hi Jason,
    Thanks for your insight, I will go through the tutorial and update accordingly.
    A lot has been changing with Facebook API and Facebook doesn’t give any official information.

Gal - April 22, 2017

Great Post! super clear and make everyone understand it..
I Looked for hours for a tool to extract singe post comments (3700 comments) and all failed to extract them all.

Jason - April 22, 2017

Hey Paulo
Can’t remember if I asked this before (as my comment is still awaiting moderation) – but I have a question for you. Scraping FB IDs seems to be a redundant activity now, no? FB seems to not allow you to use 3rd party IDs for advertising anymore – only IDs that have interacted with your page (ie your own audience)
What do you think?

    Paulo - April 24, 2017

    Hi Jason,
    I’m not into FB ads so I don’t have enough knowledge in that area but the IDs you scrape from pages are called “App-scoped User IDs”.

Lili - April 24, 2017

Hey Paulo,

Great article, thank you for all the information. As I did not manage to run the article in Powershell, I did it using python itself. I ended up with a very messy spreadsheet. Could you give me some advice?



    Paulo - April 24, 2017

    Hi Lili,
    It is an Excel issue, import the CSV as text on your Excel or save the CSV as Unicode UTF-8.


Leave a Reply: