Share:    Facebook Facebook Reddit

find friends on facebook
#1
Hello, visitor!

Article about find friends on facebook:
In this article by the authors, Vikram Garg and Sharan Kumar Ravindran , of the book, Mastering Social Media Mining with R, we learn about data mining using Facebook as our resource. (For more resources related to this topic, see here.) We will see how to use the R package Rfacebook , which provides access to the Facebook Graph API from R. It includes a series of functions that allow us to extract various data about our network such as friends, likes, comments, followers, newsfeeds, and much more.

>> ENTER THE SITE <<


We will discuss how to visualize our Facebook network and we will see some methodologies to make use of the available data to implement business cases. Rfacebook package installation and authentication. The Rfacebook package is authored and maintained by Pablo Barbera and Michael Piccirilli. It provides an interface to the Facebook API. It needs Version 2.12.0 or later of R and it is dependent on a few other packages, such as httr , rjson , and httpuv . Before starting, make sure those packages are installed. It is preferred to have Version 0.6 of the httr package installed. Installation. We will now install the Rfacebook packages. We can download and install the latest package from GitHub using the following code and load the package using the library function. On the other hand, we will also install the Rfacebook package from the CRAN network. One prerequisite for installing the package using the function install_github is to have the package devtools loaded into the R environment. The code is as follows: After installing the Rfacebook package for connecting to the API, make an authentication request. This can be done via two different methods. The first method is by using the access token generated for the app, which is short-lived (valid for two hours), on the other hand, we can create a long-lasting token using the OAuth function. Let&#8217,s first create a temporary token. Go to https://developers.facebook.com/tools/explorer, click on Get Token , and select the required user data permissions. The Facebook Graph API explorer will open with an access token. This access token will be valid for two hours. The status of the access token as well as the scope can be checked by clicking on the Debug button. Once the tokens expire, we can regenerate a new token. Now, we can access the data from R using the following code. The access token generated using the link should be copied and passed to the token variable. The use of username in the function getUsers is deprecated in the latest Graph API, hence, we are passing the ID of a user. You can get your ID from the same link that was used for token generation. This function can be used to pull the details of any user, provided the generated token has the access. Usually, access is limited to a few users with a public setting or those who use your app. It is also based on the items selected in the user data permission check page during token generation. In the following code, paste your token inside the double quotes, so that it can be reused across the functions without explicitly mentioning the actual token. A closer look at how the package works. The getUsers function using the token will hit the Facebook Graph API. Facebook will be able to uniquely identify the users as well as the permissions to access information. If all the check conditions are satisfied, we will be able to get the required data. Copy the token from the mentioned URL and paste it within the double quotes. Remember that the token generated will be active only for two hours. Use the getUsers function to get the details of the user. Earlier, the getUsers function used to work based on the Facebook friend&#8217,s name as well as ID, in API Version 2.0, we cannot access the data using the name. Consider the following code for example: Then, the details of the user, such as name and hometown, can be retrieved using the following code: The output is also mentioned for your reference: For the following code: The output is as follows: Now, let&#8217,s see how to create a long-lasting token. Open your Facebook app page by going to https://developers.facebook.com/apps/ and choosing your app. On the Dashboard tab, you will be able to see the App ID and Secret Code values. Use those in the following code. On executing the preceding statements, you will find the following message in your console: Copy the URL displayed and open your Facebook app, on the Settings tab, click on the Add Platform button and paste the copied URL in the Site URL text box. Make sure to save the changes. Then, return to the R console and press any key to continue, you will be prompted to enter your Facebook username and password. On completing that, you will return to the R console. If you find the following message, it means your long-lived token is ready to use. When you get the completion status, you might not be able to access any of the information. It is advisable to use the OAuth function a few minutes after creation of the Facebook application. After successfully authenticating, we can save it and load on demand using the following code: When it is required to automate a few things or to use Rfacebook extensively, it will be very difficult as the tokens should be generated quite often. Hence, it is advisable to create a long-lasting token to authenticate the user, and then save it. Whenever required, we can just load it from a local file. Note that Facebook authentication might take several minutes. Hence, if your authentication fails on the retry, please wait for some time before pressing any key and check whether you have installed the httr package Version 0.6. If you continue to experience any issues in generating the token, then it&#8217,s not a problem. We are good to go with the temporary token. Exercise Create an app in Facebook and authenticate by any one of the methods discussed. A basic analysis of your network. In this section, we will discuss how to extract Facebook network of friends and some more information about the people in our network.













How do you find hidden friends on facebook


How to find messenger friend location


How to find out who recently unfriended you on facebook
Reply


Messages In This Thread
find friends on facebook - by franklinkelsey5 - 8 hours ago

Forum Jump:


Users browsing this thread: 3 Guest(s)