Learn R Programming

FlickrAPI

The goal of FlickrAPI is to provide an interface to the Flickr API and allow R users to download data on public photos uploaded to Flickr.

Installation

install.packages("FlickrAPI")
# remotes::install_github("koki25ando/FlickrAPI")

After installing, set up a Flickr API key and save it as a local environment variable using setFlickrAPIKey(api_key = "YOUR_API_KEY_HERE", install = TRUE). The Flickr API is available for non-commercial use by outside developers and is only available for commercial use under prior arrangements. Review the Flickr API documentation, API Overview, or Flickr Developer Guide for more information.

Example

You can get photos from any individual user using the getPhotos() function.

library(FlickrAPI)

photos <- getPhotos(user_id = "grand_canyon_nps")
knitr::kable(photos[1,])
idownersecretserverfarmtitleispublicisfriendisfamily
5192467776950693818@N08a48d45c811655356603/03/22 Desert View Amphitheater Reconstruction 40389100

For more information about any individual image, you can use getPhotoInfo() or the getExif() function.

photo_info <- getPhotoInfo(photo_id = photos$id[1], output = "tags")
knitr::kable(photo_info[c(1:2),])
idauthorauthornamerawcontentmachine_tag
50601005-51924677769-8346950693818@N08Grand Canyon NPSDesert Viewdesertview0
50601005-51924677769-2696050693818@N08Grand Canyon NPSAmphitheateramphitheater0
photo_exif <- getExif(photo_id = photos$id[10])
knitr::kable(photo_exif[1,])
tagspacetagspaceidtaglabelrawclean
JFIF0JFIFVersionJFIFVersion1.02NA

You can also search photos by tag and license.

photo_search <- getPhotoSearch(
  sort = "date-taken-desc",
  tags = c("cats", "dogs"),
  per_page = 50)

knitr::kable(photo_search[1,])
idownersecretserverfarmtitleispublicisfriendisfamilyimg_urlimg_heightimg_widthimg_asp
5195819389450281068@N08ca8e35eb2b6553566Cats Of Mei Ling100https://live.staticflickr.com/65535/51958193894_ca8e35eb2b_s.jpg75751

See also

Copy Link

Version

Install

install.packages('FlickrAPI')

Monthly Downloads

199

Version

0.1.0.1

License

GPL (>= 3)

Maintainer

Koki Ando

Last Published

July 11th, 2022

Functions in FlickrAPI (0.1.0.1)

FlickrAPIRequest

Request data from the Flickr API
FlickrAPI-package

FlickrAPI: Access to Flickr API via R
getPhotoInfo

Get available information for a Flickr photo.
getPhotoSearch

Search for photos on Flickr by user id, tags, license, or bounding box
getExif

Get EXIF data for a Flickr photo.
setFlickrAPIKey

Set and get a Flickr API key to/from environment variables.
%>%

Pipe operator
getPhotos

Get Flickr user photos or a user's favorite photos
getHotTags

Get a data frame of hot tags for a given time period.