1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FB Page Like/Comment per post scraper & 4 Google+ Macros

Discussion in 'Social Networking Sites' started by Salty, Jan 29, 2012.

  1. Salty

    Salty Junior Member

    Joined:
    Jun 23, 2010
    Messages:
    132
    Likes Received:
    36
    Location:
    Portland. Oregon
    (I wasn't sure to put this in the Facebook subforum because of the 3 Google+ macros I'm pasting inside here, I apologize in advance if that's not OK)

    So basically I want to scrape the comments/likes count per post on a Facebook page in order to do Analysis. For example, if someone has 3,000 posts they made to their wall, I would like to know how many likes and Comments they received for each, date included would be awesome. If anyone can help me out with that, I would be much appreciated.

    I'm also completing a Sentiment Analysis lexicon if someone contacts me that would like to extend this to the overall sentiment of the wall post and how it translates into Likes/Comments; but of course this would be for far advanced individuals that would like to jump into the overall project I'm working on (if you like publicity).

    I also have an archive of over 400million Tweets archived from protest and revolution Hashtags from 2011-2012 if that interests anyone who does "Big Data" analysis/visualizations/graphs. This would be in exchange for the help I need posted above.



    Now onto the Google+ Macros I'm giving you pals, all these are using the browser plugin "iMacros."

    1.

    This macro Expands all comments and +1s them in order to send a bulk amount of users a "red notification" in order for them to follow me back. I've been doing this about 3 times a week since Sept and have been getting noticeable results.

    Before you start this, go to plus.googleDOTcom/hot or circlecountDOTcom to locate the most commented profiles (so that you may +1 the most possible posts you can).

    Expanding Comments Macro:

    hxxp://pastebinDOTcom/BvMafVG0

    +1 macro

    hxxp://pastebinDOTcom/srM6fbZd

    2.

    This macro is for a Google Plus Company page. This goes to the top 5,100(ish) Google+ Company pages and follows them in order to acquire follow-backs. This macro takes about 4-5 days to run because it sometimes hangs due to page-load. Because of the page loading issues, it may be mandatory to "babysit." I highly suggest using Adblock to remove the "comment wall" so that images/comments/videos don't slow down your page loading and thus making your macro run slower.

    If your macro hangs, sometimes it is necessary to manually +1 the page and/or change the url in your browser so that the macro stops "hanging."

    Replace "YOURPLUSPAGE" with the ID of your google+ page. You also have to connect the page IDs with the ID list as the completed macro is around 1.2MB

    hxxp://pastebinDOTcom/32yFt4Xm

    After you hit the 5k cap for people in your circles, you can go to circle management, view people who have your page in their circles, and then block them. This is so you can remove the pages that followed you back from your circles so you can add more. The act of "blocking" someone removes them from your previous circle. The macro below will allow you to unblock these individuals that added you to their circles.

    From the url /circles/addedyou run this macro and loop it as many times as needed.

    hxxp://pastebinDOTcom/Lbuqw2XC
     
    • Thanks Thanks x 1
    Last edited: Jan 30, 2012
  2. Salty

    Salty Junior Member

    Joined:
    Jun 23, 2010
    Messages:
    132
    Likes Received:
    36
    Location:
    Portland. Oregon
    I'm working on this FB page/like comment count per post thing if anyone wants to join in. I'm currently working on.... "Since <a> and <img> tag are inside of <div>, How can I tell iMacro to go to this <div> and extract the content that I want from <a> and <img>. The class is unique, I just need to know how to form it."

    Here is a macro to expand all the old facebook posts, put this guy on loop.

    Code:
    VERSION BUILD=3520704 RECORDER=CR
    TAG POS=1 TYPE=A ATTR=TXT:Older<SP>Posts
    WAIT SECONDS=10
    
     
    Last edited: Jan 30, 2012
  3. Salty

    Salty Junior Member

    Joined:
    Jun 23, 2010
    Messages:
    132
    Likes Received:
    36
    Location:
    Portland. Oregon
    My goal is to scrape: Content, Likes(count), Shares(count), Comments(count)

    The issue is that when I run my macro, it won't go in order because some wall posts are images/videos which throws off the macro. The image below is an example of how I need help with relative positioning.

    I ran this on a loop(x2) and you see the third wall post? Because of the macro jumping ahead like this, I won't get an accurate extraction.



    Each one of these posts are housed in a div called:

    Code:
    <div class="mainWrapper">
    
    Here is my current Macro.

    Code:
    VERSION BUILD=7300701 RECORDER=FX
    TAB T=1
    SET !EXTRACT_TEST_POPUP NO
    
    
    'Store the value of !loop in a variable
    SET !VAR1 {{!LOOP}}
    
    'Scrapes Date of Original Post
    TAG POS={{!VAR1}} TYPE=SPAN ATTR=CLASS:uiStreamSource&&TXT:* EXTRACT=txt
    
    'Scrapes Likes of Original Post
    TAG POS={{!VAR1}} TYPE=A ATTR=TXT:*<SP>people EXTRACT=txt
    
    'Scrapes number of shares of Original Post
    TAG POS={{!VAR1}} TYPE=A ATTR=TXT:*<SP>shares EXTRACT=txt
    
    'Scrapes how many comments were made
    TAG POS={{!VAR1}} TYPE=INPUT:SUBMIT ATTR=Value:View<SP>all<SP>* EXTRACT=txt
    
    'Scrapes Content of Original Post
    TAG POS=R{{!VAR1}} TYPE=SPAN ATTR=CLASS:messageBody&&TXT:* EXTRACT=txt
    
    
    
    'Saves Extracted Data
    SAVEAS TYPE=EXTRACT FOLDER=D:\MyMacros\ FILE=Extract_facebook.txt
    'Scrapes Next Post on Wall
    ADD !VAR1 1
    
    Appreciate any help in advance.
     

    Attached Files:

  4. Salty

    Salty Junior Member

    Joined:
    Jun 23, 2010
    Messages:
    132
    Likes Received:
    36
    Location:
    Portland. Oregon
    Small update, sort-of. (I'd rather not use this macro below, because if there are comments on a wall post, I will need to clean up my extracted file so that it doesn't include random comments.)

    I have the macro below that extract all the content of a Facebook Wall post, except the "View all 4 comments" since that is a button with the text as value=""

    Code:
    TAG POS={{!VAR1}} TYPE=DIV ATTR=CLASS:mainWrapper EXTRACT=txtall
    So I'm sort of in the same predicament because I need to extract each wall post sequencially without the macro jumping ahead when there are no comments present on a particular wall post.

    Code:
    TAG POS={{!VAR1}} TYPE=INPUT:SUBMIT ATTR=Value:View<SP>all<SP>* EXTRACT=txt
    I hope I'm being very clear.

    If you would like to follow along, I'm at this facebook page facebookDOTcom/egyjoy

    If you would like to test a Facebook page where there isn't a comment on every wall post I'm testing at facebookDOTcom/arabrevolution
     
  5. Salty

    Salty Junior Member

    Joined:
    Jun 23, 2010
    Messages:
    132
    Likes Received:
    36
    Location:
    Portland. Oregon
    Still need original help but thought I would update on progress while I wait for a response.

    I went ahead and ran the above code in the post on "egyjoy" and posted the final results after cleansing the text:

    docs.googleDOTcom/spreadsheet/ccc?key=0ApFhmUJVxdDwdHp6NnNkSm4yNnBEUmNpZFdNeEJPZVE

    This is how I cleaned the text in Notepad++

    Code:
    replace LikeUnlike with " · "
    replace " · " with \t
    replace people like this. with "people like this. \t"
    replate shares with "shares \t"
    replate 1 share with "1 share \t"
    replace Write a comment..." with ""
    
    Delete row BC
    Delete B again
    
    Sometimes it will scrape comments, which you are not trying to extract. They mainly show up in columns that aren't suppose to have over a certain amount of characters, which is easy to macro in Excel.