searchInstagram function

Search public media that mention a specific hashtag, or that were sent from a given area

Search public media that mention a specific hashtag, or that were sent from a given area

searchInstagram retrieves public pictures and video whose caption mentions a given hashtag, or that were sent within a given area, delimited by a set of coordinates and a radius. It returns a data frame with information about each picture or video, and optionally will download all pictures to a specific folder

searchInstagram(tag = NULL, token, n = 100, lat = NULL, lng = NULL, distance = NULL, folder = NULL, mindate = NULL, maxdate = NULL, verbose = TRUE, sleep = 0)

Arguments

  • tag: Hashtag used to filter media. It is only possible for a single hashtag.
  • token: An OAuth token created with instaOAuth.
  • n: Maximum number of media to return.
  • lat: Latitude of the center search coordinate
  • lng: Longitude of the center search coordinate
  • distance: Default is 1km (distance=1000), max distance is 5km.
  • folder: If different than NULL, will download all pictures to this folder.
  • mindate: Minimum date for search period
  • maxdate: Maximum date for search period
  • verbose: If TRUE (default), outputs details about progress of function on the console.
  • sleep: Number of seconds between API calls (default is 0).

Details

It is only possible to apply one filter at a time: either search by hashtag OR search by coordinates.

The mindate and maxdata search parameters only work when searching by location, not when searching by tag.

IMPORTANT: After June 1st, 2016 only applications that have passed permission review by Instagram will be allowed to access this API endpoint. See https://www.instagram.com/developer/review/ for more information.

Examples

## Not run: ## See examples for instaOAuth to know how token was created. ## Searching and downloading 100 public media that mention #obama load("my_oauth") obama <- searchInstagram( tag="obama", token=my_oauth, n=100, folder="obama") ## Searching and downloading pictures sent from Times Square with a minimum date ## of 2013-12-31 and a maximum date of 2014-01-01 tsq <- searchInstagram( lat=40.7577, lng=-73.9857, distance=500, token=my_oauth, n=500, folder="timessquare", mindate="2014-12-31", maxdate="2014-01-01") ## End(Not run)

Author(s)

Pablo Barbera pablo.barbera@nyu.edu

See Also

instaOAuth

  • Maintainer: Pablo Barbera
  • License: GPL-2
  • Last published: 2016-08-17