get_socialmedia: A social media search and analytic tool

Description Usage Arguments Details Value Author(s) Examples

View source: R/get_socialmedia.R

Description

Takes one or multiple URL(s) and returns the information about the popularity and reach of the URL(s) on several social media platforms. It retrieves the number of shares, likes, pins, and hits on Facebook, Pinterest, StumbleUpon, LinkedIn, and Reddit. Version 0.2 of get_socialmedia() no longer returns the number of tweets for the URL(s) as a result of Twitter's decision of discontinuing the Tweet share count API endpoint. Please note it can be time consuming to search for a large number of URLs. This function also accepts the optional variable sleep.time (default=0) to avoid hitting API limits (if implemented). Use sleep.time to define the number of seconds the function will wait before proceeding to the next URL. If the URLs are shortened, you will have to first resolve them using the function get_url(). The function also requires the inclusion of the trailing slash at the end of the address if searching for a domain.

Usage

1
get_socialmedia(links, sleep.time = 0)

Arguments

links

URL or list of URLs to be tracked across Facebook, Pinterest, StumbleUpon, LinkedIn, and Reddit.

sleep.time

Number of seconds the function will wait before proceeding to the next URL (optional)

Details

Most social media APIs fail to return valid results for shortened URLs. For these cases you should first use the funtion get_url() included in this the package that quickly resolves shortened URLs. The function get_url() can be used together with get_socialmedia().

Value

Returns a data frame with the number of shares, likes, pins, and hits on Facebook, Pinterest, StumbleUpon, LinkedIn, and Reddit. The resulting data frame includes the following 15 columns:

url

URL searched

normalized_url

URL returned

fbk_shares

number of Facebook shares

fbk_likes

number of Facebook likes

fbk_comments

number of Facebook comments

fbk_total

total number of hits on Facebook

fbk_clicks

number of Facebook clicks

rdt_score

Reddit score

rdt_downs

number of downs on Reddit

rdt_ups

number of ups on Reddit

rdt_comments

number of comments on Reddit

lkn_shares

number of LinkedIn shares

stu_views

number of StumbleUpon views

pin_counts

number of pins on Pinterest

Author(s)

Marco Bastos

Examples

1
get_socialmedia("http://cran.r-project.org/")

Example output

Error in function (type, msg, asError = TRUE)  : 
  Failed to connect to graph.facebook.com port 80: Connection refused
Error : lexical error: invalid char in json text.
                                       Error in function (type, msg, a
                     (right here) ------^

Error in function (type, msg, asError = TRUE)  : 
  Failed to connect to buttons.reddit.com port 80: Connection refused
Error : lexical error: invalid char in json text.
                                       Error in function (type, msg, a
                     (right here) ------^

Error in function (type, msg, asError = TRUE)  : 
  Failed to connect to www.linkedin.com port 443: Connection refused
Error : lexical error: invalid char in json text.
                                       Error in function (type, msg, a
                     (right here) ------^

Error in function (type, msg, asError = TRUE)  : 
  Failed to connect to www.stumbleupon.com port 80: Connection refused
Error : lexical error: invalid char in json text.
                                       Error in function (type, msg, a
                     (right here) ------^

Error in function (type, msg, asError = TRUE)  : 
  Failed to connect to api.pinterest.com port 80: Connection refused
Error : lexical error: invalid char in json text.
                                       Error in function (type, msg, a
                     (right here) ------^

[1] "Query execution time: 0 minutes"
  url normalized_url fbk_shares fbk_comments rdt_score rdt_downs rdt_ups
1   0              0          0            0         0         0       0
  rdt_comments lkn_shares stu_views pin_counts
1            0          0         0          0

SocialMediaMineR documentation built on May 29, 2017, 11:44 p.m.