Title: | Access to Flickr API |
---|---|
Description: | Provides an interface to the Flickr API <https://www.flickr.com/services/api/> and allows R users to download data on Flickr. |
Authors: | Koki Ando [aut, cre], Eli Pousson [aut, ctb] |
Maintainer: | Koki Ando <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.0.1 |
Built: | 2024-11-14 03:28:47 UTC |
Source: | https://github.com/koki25ando/flickrapi |
Request data from the Flickr API using the provided method, API key, and any
additional values passed to httr2::req_url_query()
.
FlickrAPIRequest( method = NULL, api_key = NULL, format = "json", simplifyVector = TRUE, check_type = FALSE, ... )
FlickrAPIRequest( method = NULL, api_key = NULL, format = "json", simplifyVector = TRUE, check_type = FALSE, ... )
method |
Flickr API method to use for request. |
api_key |
Flickr API key. If api_key is |
format |
Format parameter passed to |
simplifyVector |
Default to |
check_type |
Default to |
... |
Additional parameters passed to |
Return a data of EXIF data for a given photo. The calling user must have permission to view the photo.
getExif(api_key = NULL, photo_id = NULL, secret = NULL) get_exif(api_key = NULL, photo_id = NULL, secret = NULL)
getExif(api_key = NULL, photo_id = NULL, secret = NULL) get_exif(api_key = NULL, photo_id = NULL, secret = NULL)
api_key |
Flickr API key. If api_key is |
photo_id |
The id of the photo to fetch EXIF information for. |
secret |
The secret for the photo. If the correct secret is passed then permissions checking is skipped. This enables the 'sharing' of individual photos by passing around the id and secret. |
A data.frame with EXIF information for an image with the provided photo_id.
Flickr API Documentation: flickr.photos.getExif
## Not run: getExif( api_key = get_flickr_api_key(), photo_id = "45961963324" ) ## End(Not run)
## Not run: getExif( api_key = get_flickr_api_key(), photo_id = "45961963324" ) ## End(Not run)
Get a data frame of hot tags for a given time period.
getHotTags(api_key = NULL, period = c("day", "week"), count = 20) get_hot_tags(api_key = NULL, period = c("day", "week"), count = 20)
getHotTags(api_key = NULL, period = c("day", "week"), count = 20) get_hot_tags(api_key = NULL, period = c("day", "week"), count = 20)
api_key |
Flickr API key. If api_key is |
period |
The period for which to fetch hot tags. Valid values are day or week. Defaults to day |
count |
The number of tags to return. Defaults to 20. Maximum allowed value is 200. |
This function a data frame of hot tags for the given period
Flickr API Documentation: flickr.tags.getHotList
## Not run: getHotTags( api_key = get_flickr_api_key(), period = "day", count = 20 ) ## End(Not run)
## Not run: getHotTags( api_key = get_flickr_api_key(), period = "day", count = 20 ) ## End(Not run)
R access to photo information of photos posted on Flickr via Flickr API.
getPhotoInfo( api_key = NULL, photo_id, output = c("location", "date", "url", "tags") ) get_photo_info( api_key = NULL, photo_id, output = c("location", "date", "url", "tags") )
getPhotoInfo( api_key = NULL, photo_id, output = c("location", "date", "url", "tags") ) get_photo_info( api_key = NULL, photo_id, output = c("location", "date", "url", "tags") )
api_key |
Flickr API key. If api_key is |
photo_id |
The id of the photo to get information for. |
output |
Output data type. Supported options include "all", "location",
"date", "url" or "tags". If |
This function returns data of specific photo's information.
Flickr API Documentation: flickr.photos.getInfo
## Not run: getPhotoInfo( api_key = get_flickr_api_key(), photo_id = "30484882493", output = "location" ) ## End(Not run)
## Not run: getPhotoInfo( api_key = get_flickr_api_key(), photo_id = "30484882493", output = "location" ) ## End(Not run)
Returns photos from the given user's photo stream. Only photos visible to the calling user will be returned.
getPhotos(user_id = NULL, img_size = "s", extras = NULL, api_key = NULL, ...) get_photos(user_id = NULL, img_size = "s", extras = NULL, api_key = NULL, ...) getFavePhotos( user_id = NULL, img_size = "s", extras = NULL, fave_date = NULL, public = TRUE, api_key = NULL, page = NULL, per_page = 100, ... ) get_fave_photos( user_id = NULL, img_size = "s", extras = NULL, fave_date = NULL, public = TRUE, api_key = NULL, page = NULL, per_page = 100, ... )
getPhotos(user_id = NULL, img_size = "s", extras = NULL, api_key = NULL, ...) get_photos(user_id = NULL, img_size = "s", extras = NULL, api_key = NULL, ...) getFavePhotos( user_id = NULL, img_size = "s", extras = NULL, fave_date = NULL, public = TRUE, api_key = NULL, page = NULL, per_page = 100, ... ) get_fave_photos( user_id = NULL, img_size = "s", extras = NULL, fave_date = NULL, public = TRUE, api_key = NULL, page = NULL, per_page = 100, ... )
user_id |
The NSID of the user whose photos to return. A value of "me" return the calling user's photos. |
img_size |
A character string with the abbreviation for one or more
image sizes ("sq", "t", "s", "q", "m", "n", "z", "c", "l", or "o"). If a
single img_size is provided the url, width, and height columns are renamed
(e.g. img_url instead of url_sq) and an img_asp column is added to the
results; defaults to |
extras |
A vector of extra information to fetch for each returned record. Currently supported fields are: c("description", "license", "date_upload", "date_taken", "owner_name", "icon_server", "original_format", "last_update", "geo", "tags", "machine_tags", "o_dims", "views", "media", "path_alias", "url_sq", "url_t", "url_s", "url_q", "url_m", "url_n", "url_z", "url_c", "url_l", "url_o") |
api_key |
Flickr API key. If api_key is |
... |
Arguments passed on to
|
fave_date |
Date favorited in any format supported by |
public |
If |
page |
Number specifying which search results page to return. Default is page 1 of results returned. |
per_page |
Number specifying how many results per page to return.
Default 100 results per page. Maximum of 250 if |
For getFavePhotos()
the provided user_id may need to be the NSID code or
the user name rather than the typical user id due to some inconsistencies in
the Flickr API.
A data.frame
with basic information on photos.
Flickr API documentation: flickr.favorites.getPublicList or flickr.favorites.getList
## Not run: getPhotos( api_key = get_flickr_api_key(), user_id = "141696738@N08" ) ## End(Not run)
## Not run: getPhotos( api_key = get_flickr_api_key(), user_id = "141696738@N08" ) ## End(Not run)
Use the Flickr Search API to return pages of photos sorted by date posted, date taken, interestingness, and relevance. Optional search parameters including spatial bounding box, user id, tags, and image license.
getPhotoSearch( api_key = NULL, user_id = NULL, tags = NULL, license_id = NULL, sort = "date-posted", desc = FALSE, bbox = NULL, img_size = NULL, date = NULL, upload_date = NULL, extras = NULL, per_page = 100, page = NULL, ... ) get_photo_search( api_key = NULL, user_id = NULL, tags = NULL, license_id = NULL, sort = "date-posted", desc = FALSE, bbox = NULL, img_size = NULL, date = NULL, upload_date = NULL, extras = NULL, per_page = 100, page = NULL, ... )
getPhotoSearch( api_key = NULL, user_id = NULL, tags = NULL, license_id = NULL, sort = "date-posted", desc = FALSE, bbox = NULL, img_size = NULL, date = NULL, upload_date = NULL, extras = NULL, per_page = 100, page = NULL, ... ) get_photo_search( api_key = NULL, user_id = NULL, tags = NULL, license_id = NULL, sort = "date-posted", desc = FALSE, bbox = NULL, img_size = NULL, date = NULL, upload_date = NULL, extras = NULL, per_page = 100, page = NULL, ... )
api_key |
Flickr API key. If api_key is |
user_id |
The NSID of the user with photos to search. If this parameter
is |
tags |
A vector of tags to search for. |
license_id |
The license id for photos. For possible values, see the Flickr API method flickr.photos.licenses.getInfo or see details for more information. If license_id is provided, "license" is added to extras. |
sort |
Order to sort returned photos. The possible values are: "date-posted-asc", "date-posted-desc", "date-taken-asc", "date-taken-desc", "interestingness-desc", "interestingness-asc", and "relevance" The trailing "-asc" or "-desc" indicator for sort direction is optional when using the desc parameter. |
desc |
If |
bbox |
A object of class |
img_size |
A character string with the abbreviation for one or more
image sizes ("sq", "t", "s", "q", "m", "n", "z", "c", "l", or "o"). If a
single img_size is provided the url, width, and height columns are renamed
(e.g. img_url instead of url_sq) and an img_asp column is added to the
results; defaults to |
date |
Date taken in any format supported by |
upload_date |
Date uploaded in any format supported by |
extras |
A vector of extra information to fetch for each returned record. Currently supported fields are: c("description", "license", "date_upload", "date_taken", "owner_name", "icon_server", "original_format", "last_update", "geo", "tags", "machine_tags", "o_dims", "views", "media", "path_alias", "url_sq", "url_t", "url_s", "url_q", "url_m", "url_n", "url_z", "url_c", "url_l", "url_o") |
per_page |
Number specifying how many results per page to return.
Default 100 results per page. Maximum of 250 if |
page |
Number specifying which search results page to return. Default is page 1 of results returned. |
... |
Dots can be used to pass any additional arguments supported by the
flickr.photos.search
API method excluding license, min_taken_date, max_taken_date,
min_upload_date, and max_upload_date which are supported by other named
parameters. Dots also support two legacy parameters: licence_id (variant
spelling for license_id) and geo (set |
License id options:
license_id can be an integer from 0 to 10 or a corresponding license code including:
"c" (All Rights Reserved),
"by-bc-sa" (Attribution-NonCommercial-ShareAlike),
"by-nc" (Attribution-NonCommercial),
"by-nc-nd" (Attribution-NonCommercial-NoDerivs),
"by" (Attribution),
"by-sa" (Attribution-ShareAlike),
"by-nd" (Attribution-NoDerivs),
"nkc" (No known copyright restrictions),
"pd-us" (United States Government Work),
"cc0" (Public Domain Dedication),
or "pd" (Public Domain Mark).
This function returns data of specific photos matching search parameters.
Flickr API Documentation: flickr.photos.search
## Not run: # Search for photos tagged "cats" and "dogs" # Return images in descending order of date taken getPhotoSearch( api_key = get_flickr_api_key(), sort = "date-taken-desc", tags = c("cats", "dogs") ) ## End(Not run) ## Not run: # Search for photos uploaded to the NPS Grand Canyon user account. # Return extra fields including the date taken and square image URL. getPhotoSearch( api_key = get_flickr_api_key(), user_id = "grand_canyon_nps", extras = c("date_taken", "url_sq") ) ## End(Not run) ## Not run: # Search for photos tagged "panda" in the area of Ueno Zoo, Tokyo, Japan getPhotoSearch( api_key = get_flickr_api_key(), tags = "panda", bbox = c(139.7682226529, 35.712627977, 139.7724605432, 35.7181464141), extras = c("geo", "owner_name", "tags") ) ## End(Not run)
## Not run: # Search for photos tagged "cats" and "dogs" # Return images in descending order of date taken getPhotoSearch( api_key = get_flickr_api_key(), sort = "date-taken-desc", tags = c("cats", "dogs") ) ## End(Not run) ## Not run: # Search for photos uploaded to the NPS Grand Canyon user account. # Return extra fields including the date taken and square image URL. getPhotoSearch( api_key = get_flickr_api_key(), user_id = "grand_canyon_nps", extras = c("date_taken", "url_sq") ) ## End(Not run) ## Not run: # Search for photos tagged "panda" in the area of Ueno Zoo, Tokyo, Japan getPhotoSearch( api_key = get_flickr_api_key(), tags = "panda", bbox = c(139.7682226529, 35.712627977, 139.7724605432, 35.7181464141), extras = c("geo", "owner_name", "tags") ) ## End(Not run)
Set and get a Flickr API key to/from environment variables.
Get Flickr API key from environment variables
setFlickrAPIKey(api_key, overwrite = FALSE, install = FALSE) set_flickr_api_key(api_key, overwrite = FALSE, install = FALSE) getFlickrAPIKey(api_key = NULL) get_flickr_api_key(api_key = NULL)
setFlickrAPIKey(api_key, overwrite = FALSE, install = FALSE) set_flickr_api_key(api_key, overwrite = FALSE, install = FALSE) getFlickrAPIKey(api_key = NULL) get_flickr_api_key(api_key = NULL)
api_key |
Flickr API key |
overwrite |
If |
install |
If |