Skip to content

A Wrapper To Retrieve Data From The CrowdTangle API

Notifications You must be signed in to change notification settings

untergeekDE/RCrowdTangle

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RCrowdTangle

A Wrapper To Retrieve Data From The CrowdTangle API

This package provides programmatic accces to the CrowdTangle API with R. Users need to have a CrowdTangle account in order to make API calls.

The package currently supports using the links and posts endpoints of the CrowdTangle API, as well as the post/:id query (Facebook only!) to retrieve data on specific URLs and posts as well as searching for posts.

Installing

Download the RCrowdTangle.R file from the R folder, place it in your working directory, and include it with source("RCrowdTangle.R")

As it's not a proper R library yet, installing it with

devtools::install_github("untergeekDE/RCrowdTangle")

will lead to errors. Yet.

Function calls

  • ct_auth(token, overwrite=FALSE) - Set Crowdtangle token as an environment variable
  • ct_get_links() Call Links endpoint (consult CT API documentation )
  • ct_get_posts() Call Posts endpoint (consult CT API documentation )
  • ct_search_posts - Basically ct_get_posts() with a focus on search terms.
  • ct_get_post_by_id(id) - Call Post by ID endpoint (consult CT API doc)
  • ct_get_fb_post(url) - Return information on single FB post

Examples

(TODO)

Rate limit

The default rate limit for CrowdTangle API calls is 6 per minute (with the exception of the /links call which is limited to 2 calls per minute). The function calls wait for a fraction of a second before returning.

If you wish to change the rate limit to something lower, use

  • ct_set_api_limit(n)
  • ct_set_api_limit(n, links=TRUE)

to set the limit to n calls per minute. Whenever a query is done, a timer is set via the

Todo

  • Examples and use cases
  • Convert to a proper R library (anybody any advice how to do this?)
  • /posts/search call (invitation only!)
  • /leaderboard call
  • /lists call
  • /lists/:listid/accounts call
  • /ctpost/:id call (hidden, possibly deprecated)
  • clean up the rather messy parameter structure for the calls
  • Error handling

About

A Wrapper To Retrieve Data From The CrowdTangle API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%