This vignette provides a quick tour of the R package âFlickrAPIâ. This package is maintained by Koki Ando.
Installation# pak::pkg_install("koki25ando/FlickrAPI")
library(FlickrAPI)
Setting up a Flickr API key
# Set the API key for a single session
setFlickrAPIKey(api_key = "YOUR_API_KEY_HERE")
# Install the API key for future sessions
setFlickrAPIKey(api_key = "YOUR_API_KEY_HERE", install = TRUE)
# Overwrite an existing API key
setFlickrAPIKey(api_key = "YOUR_API_KEY_HERE", overwrite = TRUE)
Searching for Flickr photos
There are two functions for searching Flickr photos:
getPhotos()
getPhotoSearch()
getPhotos()
allows you to get public photos for any Flickr user or all photos from the account associated with the Flickr API key.
# Search for photos uploaded by Koki Ando
getPhotos(user_id = "141696738@N08")
getPhotoSearch()
supports a broader range of search options including:
getPhotoSearch(tags = c("cats","dogs"))
# Search for photos of cats and dogs in North Carolina
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"))
nc_bbox <- sf::st_bbox(nc)
getPhotoSearch(tags = c("cats","dogs"), bbox = nc_bbox)
getPhotoSearch()
returns 100 photos per page by default but this can be increased to 250 if using the bbox parameter searching by location or 500 otherwise. Additional pages can be accessed using the page parameter.
The extras parameter can be used to return additional information about the photos including âdescriptionâ, âdate_uploadâ, âdate_takenâ, âowner_nameâ, and urls for all available image sizes.
# Search for photos tagged "panda" in the area of Ueno Zoo, Tokyo, Japan
getPhotoSearch(
tags = "panda",
bbox = c(139.7682226529, 35.712627977, 139.7724605432, 35.7181464141),
sort = "interestingness-desc",
extras = c("geo", "tags")
)
Get data on Flickr photos
There are two functions for getting data about a specific Flickr photo:
getExif()
getPhotoInfo()
getPhotoInfo(photo_id="51899696261",
output = "url")
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4