summaryrefslogtreecommitdiffstats
path: root/gallery_dl/extractor/vsco.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/extractor/vsco.py')
-rw-r--r--gallery_dl/extractor/vsco.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/gallery_dl/extractor/vsco.py b/gallery_dl/extractor/vsco.py
index 41141c6..c112f4a 100644
--- a/gallery_dl/extractor/vsco.py
+++ b/gallery_dl/extractor/vsco.py
@@ -46,6 +46,8 @@ class VscoExtractor(Extractor):
url = "https://image-{}.vsco.co/{}".format(cdn, path)
elif cdn.isdecimal():
url = "https://image.vsco.co/" + base
+ elif img["responsive_url"].startswith("http"):
+ url = img["responsive_url"]
else:
url = "https://" + img["responsive_url"]
@@ -238,6 +240,34 @@ class VscoSpacesExtractor(VscoExtractor):
yield Message.Queue, url, space
+class VscoAvatarExtractor(VscoExtractor):
+ """Extractor for vsco.co user avatars"""
+ subcategory = "avatar"
+ pattern = USER_PATTERN + r"/avatar"
+ example = "https://vsco.co/USER/avatar"
+
+ def images(self):
+ url = "{}/{}/gallery".format(self.root, self.user)
+ page = self.request(url).text
+ piid = text.extr(page, '"profileImageId":"', '"')
+
+ url = "https://im.vsco.co/" + piid
+ # needs GET request, since HEAD does not redirect to full URL
+ response = self.request(url, allow_redirects=False)
+
+ return ({
+ "_id" : piid,
+ "is_video" : False,
+ "grid_name" : "",
+ "upload_date" : 0,
+ "responsive_url": response.headers["Location"],
+ "video_url" : "",
+ "image_meta" : None,
+ "width" : 0,
+ "height" : 0,
+ },)
+
+
class VscoImageExtractor(VscoExtractor):
"""Extractor for individual images on vsco.co"""
subcategory = "image"