Learn R Programming

bdpar (version 1.0.1)

Connections: Class to manage the connections with Twitter and YouTube

Description

The tasks of the functions that the Connections class has are to establish the connections and control the number of requests that have been made with the APIs of Twitter and YouTube.

Usage

Connections

Arguments

Constructor

Connections$new(keysPath)

  • Arguments:

    • keysPath: (character) path of the .ini file that contains the keys.

Methods

  • getTwitterToken: gets the Twitter token ID.

    • Usage: getTwitterToken()

    • Value: value of twitterToken.

  • startConnectionWithTwitter: is responsible of establishing the connection to Twitter.

    • Usage: startConnectionWithTwitter()

  • checkRequestToTwitter function in charge of handling the connection with Twitter.

    • Usage: checkRequestToTwitter()

  • startConnectionWithYoutube function able to establish the connection with YouTube.

    • Usage: startConnectionWithYoutube()

  • addNumRequestToYoutube function that increases in one the number of request to YouTube.

    • Usage: addNumRequestToYoutube()

  • checkRequestToYoutube handles the connection with YouTube.

    • Usage: checkRequestToYoutube()

  • getNumRequestMaxToYoutube gets the number of maximum requests allowed by YouTube API.

    • Usage: getNumRequestMaxToYoutube()

    • Value: value of number maximun of request to YouTube.

Private fields

  • keys: (list) the keys of Twitter and YouTube.

  • numRequestToYoutube: (numeric) indicates the number of requests made to YouTube.

  • numRequestMaxToYoutube: (numeric) indicates the maximum number of requests with YouTube.

  • connectionWithYoutube: (logical) indicates if the connection has been established with YouTube.

  • connectionWithTwitter: (logical) indicates if the connection has been established with Twitter.

  • twitterToken: (Token) token to establish the connection to Twitter.

Details

The way to indicate the keys of YouTube and Twitter has to be through the configuration file that contains the following structure:

[twitter]

ConsumerKey = <<consumer_key>>

ConsumerSecret = <<consumer_secret>>

AccessToken = <<access_token>>

AccessTokenSecret = <<access_token_secret>>

[youtube]

app_id = <<app_id>>

app_password = <<app_password>>

See Also

ExtractorTwtid, ExtractorYtbid