summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/flickr.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/flickr.py')
-rw-r--r--gallery_dl/extractor/flickr.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py
index f7dc3cc..c94a110 100644
--- a/gallery_dl/extractor/flickr.py
+++ b/gallery_dl/extractor/flickr.py
@@ -77,6 +77,8 @@ class FlickrImageExtractor(FlickrExtractor):
photo = self.api.photos_getInfo(self.item_id)
if self.api.exif:
photo.update(self.api.photos_getExif(self.item_id))
+ if self.api.contexts:
+ photo.update(self.api.photos_getAllContexts(self.item_id))
if photo["media"] == "video" and self.api.videos:
self.api._extract_video(photo)
@@ -268,6 +270,8 @@ class FlickrAPI(oauth.OAuth1API):
self.exif = extractor.config("exif", False)
self.videos = extractor.config("videos", True)
+ self.contexts = extractor.config("contexts", False)
+
self.maxsize = extractor.config("size-max")
if isinstance(self.maxsize, str):
for fmt, fmtname, fmtwidth in self.FORMATS:
@@ -311,6 +315,13 @@ class FlickrAPI(oauth.OAuth1API):
params = {"user_id": user_id}
return self._pagination("people.getPhotos", params)
+ def photos_getAllContexts(self, photo_id):
+ """Returns all visible sets and pools the photo belongs to."""
+ params = {"photo_id": photo_id}
+ data = self._call("photos.getAllContexts", params)
+ del data["stat"]
+ return data
+
def photos_getExif(self, photo_id):
"""Retrieves a list of EXIF/TIFF/GPS tags for a given photo."""
params = {"photo_id": photo_id}
@@ -444,6 +455,8 @@ class FlickrAPI(oauth.OAuth1API):
if self.exif:
photo.update(self.photos_getExif(photo["id"]))
+ if self.contexts:
+ photo.update(self.photos_getAllContexts(photo["id"]))
photo["id"] = text.parse_int(photo["id"])
if "owner" in photo: