diff --git a/instaloader/structures.py b/instaloader/structures.py index 3957368..ba16b0a 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -764,8 +764,11 @@ class Profile: def _obtain_metadata(self): try: if not self._has_full_metadata: - metadata = self._context.get_json('{}/feed/'.format(self.username), params={}) - self._node = metadata['entry_data']['ProfilePage'][0]['graphql']['user'] + metadata = self._context.get_iphone_json(f'api/v1/users/web_profile_info/?username={self.username}', + params={}) + if metadata['data']['user'] is None: + raise ProfileNotExistsException('Profile {} does not exist.'.format(self.username)) + self._node = metadata['data']['user'] self._has_full_metadata = True except (QueryReturnedNotFoundException, KeyError) as err: top_search_results = TopSearchResults(self._context, self.username)