diff --git a/docs/configuration.rst b/docs/configuration.rst index 841f51cc..d73cffef 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1541,6 +1541,18 @@ Description from `linking your Flickr account to gallery-dl `__. +extractor.flickr.exif +--------------------- +Type + ``bool`` +Default + ``false`` +Description + Fetch `exif` and `camera` metadata for each photo. + + Note: This requires 1 additional API call per photo. + + extractor.flickr.metadata ------------------------- Type diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 6a3c84f4..902d0a2f 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -108,8 +108,10 @@ }, "flickr": { - "videos": true, - "size-max": null + "exif": false, + "metadata": false, + "size-max": null, + "videos": true }, "furaffinity": { diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py index d7df3d7f..d44ff3c8 100644 --- a/gallery_dl/extractor/flickr.py +++ b/gallery_dl/extractor/flickr.py @@ -106,6 +106,8 @@ class FlickrImageExtractor(FlickrExtractor): def items(self): photo = self.api.photos_getInfo(self.item_id) + if self.api.exif: + photo.update(self.api.photos_getExif(self.item_id)) if photo["media"] == "video" and self.api.videos: self.api._extract_video(photo) @@ -323,6 +325,7 @@ class FlickrAPI(oauth.OAuth1API): def __init__(self, extractor): oauth.OAuth1API.__init__(self, extractor) + self.exif = extractor.config("exif", False) self.videos = extractor.config("videos", True) self.maxsize = extractor.config("size-max") if isinstance(self.maxsize, str): @@ -367,6 +370,11 @@ class FlickrAPI(oauth.OAuth1API): params = {"user_id": user_id} return self._pagination("people.getPhotos", params) + def photos_getExif(self, photo_id): + """Retrieves a list of EXIF/TIFF/GPS tags for a given photo.""" + params = {"photo_id": photo_id} + return self._call("photos.getExif", params)["photo"] + def photos_getInfo(self, photo_id): """Get information about a photo.""" params = {"photo_id": photo_id} @@ -488,6 +496,9 @@ class FlickrAPI(oauth.OAuth1API): photo["views"] = text.parse_int(photo["views"]) photo["date"] = text.parse_timestamp(photo["dateupload"]) photo["tags"] = photo["tags"].split() + + if self.exif: + photo.update(self.photos_getExif(photo["id"])) photo["id"] = text.parse_int(photo["id"]) if "owner" in photo: