diff --git a/docs/configuration.rst b/docs/configuration.rst index b0f793fb..024bf481 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1831,6 +1831,20 @@ Description It is possible to use ``"all"`` instead of listing all values separately. +extractor.instagram.metadata +---------------------------- +Type + ``bool`` +Default + ``false`` +Description + Provide extended ``user`` metadata even when referring to a user by ID, + e.g. ``instagram.com/id:12345678``. + + Note: This metadata is always available when referring to a user by name, + e.g. ``instagram.com/USERNAME``. + + extractor.instagram.order-files ------------------------------- Type diff --git a/gallery_dl/extractor/instagram.py b/gallery_dl/extractor/instagram.py index 1e1de944..677cbdda 100644 --- a/gallery_dl/extractor/instagram.py +++ b/gallery_dl/extractor/instagram.py @@ -814,13 +814,17 @@ class InstagramRestAPI(): params = {"username": screen_name} return self._call(endpoint, params=params)["data"]["user"] + @memcache(keyarg=1) def user_by_id(self, user_id): endpoint = "/v1/users/{}/info/".format(user_id) return self._call(endpoint)["user"] def user_id(self, screen_name, check_private=True): if screen_name.startswith("id:"): + if self.extractor.config("metadata"): + self.extractor._user = self.user_by_id(screen_name[3:]) return screen_name[3:] + user = self.user_by_name(screen_name) if user is None: raise exception.AuthorizationError(