diff options
| author | 2024-06-06 02:40:15 -0400 | |
|---|---|---|
| committer | 2024-06-06 02:40:15 -0400 | |
| commit | 1c28712d865e30ed752988ba0b6944882250b665 (patch) | |
| tree | e5d5083a418f5c19616cb940c090c2dfb646d3cb /gallery_dl/extractor/vsco.py | |
| parent | 6e662211019a89caec44de8a57c675872b0b5498 (diff) | |
New upstream version 1.27.0.upstream/1.27.0
Diffstat (limited to 'gallery_dl/extractor/vsco.py')
| -rw-r--r-- | gallery_dl/extractor/vsco.py | 30 |
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" |
