Friend Mining Contd…..

Yes I am still alive and well.  It has been a significantly crazy past few months.  Work has really ramped up due to staffing cuts and people jumping ship.  We finally have a few additions to the team, which has been a very welcome addition.  Thanks for your patience and let’s get back to that code that I promised about data mining FB!

Jon Newman’s FB Cmdlets sit at the core of this exercise. 

You can download the module from the following Codeplex link:  http://facebookpsmodule.codeplex.com/

In a previous post I explained how to Authenticate to FB through the module and that info can be found here: https://scriptwarrior.wordpress.com/2011/05/10/updating-facebook-from-powershell/

Once you have the FB Token in your session it is now time to start grabbing your pick axe and jack hammer.

Let’s start mining!

First let’s get a list of our friends…with the interestingly name cmdlet Get-FBFriends
PS C:\Windows\system32> Get-FBFriends
id name
-- ----
2012706 Sona Simova
3006152 Peter Seymour
5201880 Bryan Armalavage
5501594 Jorge Segarra
10237556 Ben Anderson

Now that we have our list we can pipe that list to Get-FBObjectData which will get us more information.
Then we can use the Select-Object cmdlet to get just the information that we want about our friends.

Let’s say for instance we want to find some info on all of our female friends.  Here goes 🙂

#List of Facebook friends that are ladies with their Name, Gender and Relationship_Status
$Ladies = Get-FBFriends | Get-FBObjectData | Select Name, Gender, Relationship_status | where Gender -eq female
#Now let's just group by the Relationship_Status and BOOYA! Friend Stats :)
$Ladies | Group Relationship_Status | Select Count, Name

Count Name
—– —-
21 In a relationship
115 Married
93 Unknown
30 Single
6 Engaged
2 Separated
3 Widowed
2 Divorced
1 It’s complicated

Published by ScriptWarrior

Father, Geek - Automation Evangelist with Windows Powershell

Leave a comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: