1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[instagram] add 'profile' extractor (#5262)

https://github.com/mikf/gallery-dl/issues/5262#issuecomment-2188915210
This commit is contained in:
Mike Fährmann 2024-06-28 22:51:20 +02:00
parent ea81fa985f
commit 44896b0296
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 24 additions and 1 deletions

View File

@ -430,7 +430,7 @@ Consider all listed sites to potentially be NSFW.
<tr>
<td>Instagram</td>
<td>https://www.instagram.com/</td>
<td>Avatars, Collections, Followed Users, Guides, Highlights, Posts, Reels, Saved Posts, Stories, Tag Searches, Tagged Posts, User Profiles</td>
<td>Avatars, Collections, Followed Users, Guides, Highlights, Posts, User Profile Data, Reels, Saved Posts, Stories, Tag Searches, Tagged Posts, User Profiles</td>
<td><a href="https://github.com/mikf/gallery-dl#cookies">Cookies</a></td>
</tr>
<tr>

View File

@ -596,6 +596,22 @@ class InstagramTagExtractor(InstagramExtractor):
return self.api.tags_media(self.item)
class InstagramProfileExtractor(InstagramExtractor):
"""Extractor for an Instagram user's profile data"""
subcategory = "profile"
pattern = USER_PATTERN + r"/profile"
example = "https://www.instagram.com/USER/profile/"
def items(self):
screen_name = self.item
if screen_name.startswith("id:"):
user = self.api.user_by_id(screen_name[3:])
else:
user = self.api.user_by_name(screen_name)
return iter(((Message.Directory, user),))
class InstagramAvatarExtractor(InstagramExtractor):
"""Extractor for an Instagram user's avatar"""
subcategory = "avatar"

View File

@ -166,6 +166,7 @@ SUBCATEGORY_MAP = {
"media" : "Media Files",
"note" : "Images from Notes",
"popular": "Popular Images",
"profile": "User Profile Data",
"recent" : "Recent Images",
"search" : "Search Results",
"status" : "Images from Statuses",

View File

@ -132,6 +132,12 @@ __tests__ = (
"#count" : ">= 16",
},
{
"#url" : "https://www.instagram.com/instagram/profile",
"#category": ("", "instagram", "profile"),
"#class" : instagram.InstagramProfileExtractor,
},
{
"#url" : "https://www.instagram.com/instagram/avatar",
"#category": ("", "instagram", "avatar"),