Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User not found even tho it exists #2244

Open
GonzalesPy opened this issue May 6, 2024 · 1 comment
Open

User not found even tho it exists #2244

GonzalesPy opened this issue May 6, 2024 · 1 comment
Labels
bug Bug

Comments

@GonzalesPy
Copy link

Describe the bug
User is not found, even the user exists

To Reproduce
Steps to reproduce the behavior:

ps: useruser ist just a dummy name
L = instaloader.Instaloader(download_videos=False, download_geotags=False, compress_json=False, save_metadata=False,
                                dirname_pattern="media/images", download_video_thumbnails=False)
   
posts = instaloader.Profile.from_username(L.context, "useruser").get_posts()

for post in posts:
      caption = post.caption
      mentioned_user = post.caption_mentions
      hashtags = post.caption_hashtags

        filename = L.download_post(post, "media")

Expected behavior
Downloading the images from the given user
Error messages and tracebacks
If applicable, add error messages and tracebacks to help explain your problem.

JSON Query to api/v1/users/web_profile_info/?username=useruser : 404 Not Found [retrying; skip with ^C]
JSON Query to api/v1/users/web_profile_info/?username=useruser : 404 Not Found [retrying; skip with ^C]
JSON Query to web/search/topsearch/: HTTP error code 401. [retrying; skip with ^C]
JSON Query to web/search/topsearch/: HTTP error code 401. [retrying; skip with ^C]
Traceback (most recent call last):
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 409, in get_json
    raise QueryReturnedNotFoundException("404 Not Found")
instaloader.exceptions.QueryReturnedNotFoundException: 404 Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 409, in get_json
    raise QueryReturnedNotFoundException("404 Not Found")
instaloader.exceptions.QueryReturnedNotFoundException: 404 Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 409, in get_json
    raise QueryReturnedNotFoundException("404 Not Found")
instaloader.exceptions.QueryReturnedNotFoundException: 404 Not Found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\structures.py", line 946, in _obtain_metadata
    metadata = self._context.get_iphone_json(f'api/v1/users/web_profile_info/?username={self.username}',
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 571, in get_iphone_json
    response = self.get_json(path, params, 'i.instagram.com', tempsession, response_headers=response_headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 439, in get_json
    return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 439, in get_json
    return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 427, in get_json
    raise QueryReturnedNotFoundException(error_string) from err
instaloader.exceptions.QueryReturnedNotFoundException: JSON Query to api/v1/users/web_profile_info/?username=useruser : 404 Not Found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 413, in get_json
    raise ConnectionException("HTTP error code {}.".format(resp.status_code))
instaloader.exceptions.ConnectionException: HTTP error code 401.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 413, in get_json
    raise ConnectionException("HTTP error code {}.".format(resp.status_code))
instaloader.exceptions.ConnectionException: HTTP error code 401.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): 
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 413, in get_json
    raise ConnectionException("HTTP error code {}.".format(resp.status_code))
instaloader.exceptions.ConnectionException: HTTP error code 401.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "pathxyz....poster.py", line 37, in <module>
    grab_images_from_all_users(15)
  File "pathxyz....modules\image_grabber.py", line 9, in grab_images_from_all_users
    posts = instaloader.Profile.from_username(L.context, "useruser ").get_posts()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\structures.py", line 877, in from_username
    profile._obtain_metadata()  # to raise ProfileNotExistsException now in case username is invalid
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\structures.py", line 953, in _obtain_metadata
    top_search_results = TopSearchResults(self._context, self.username)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\structures.py", line 1984, in __init__
    self._node = context.get_json('web/search/topsearch/',
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 439, in get_json
    return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 439, in get_json
    return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathzyx....Local\Programs\Python\Python312\Lib\site-packages\instaloader\instaloadercontext.py", line 429, in get_json
    raise ConnectionException(error_string) from err
instaloader.exceptions.ConnectionException: JSON Query to web/search/topsearch/: HTTP error code 401.

Process finished with exit code 1`

Instaloader version
4.11

@GonzalesPy GonzalesPy added the bug Bug label May 6, 2024
@F04C
Copy link

F04C commented May 18, 2024

I think there is no problem here since using the typical instaloader profile "useruser" retrieves the image on the account without any problem. There is nothing to be done on the side of instaloader since it is working.

Maybe there's a problem with that specific username or that they have deactivate that's why there's nothing to be downloaded anymore.

If you can, just add a code that will skip the usernames that can't be found anymore.

If downloading images from a profile using instaloader profile _username_ works, there's nothing to be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

No branches or pull requests

2 participants