althonos / InstaLooter

Another API-less Instagram pictures and videos downloader.
GNU General Public License v3.0
2.01k stars 256 forks source link

ProfileLooter fails to find common users, but only on cloud hosted machines (works locally) #298

Open take0ut opened 4 years ago

take0ut commented 4 years ago

Library version

What's the installed library version ? Check with instalooter --version:

instalooter v2.4.4

Environment

Describe here your environment, including:

Ubuntu 16.04 Python 3.5

Error description - runtime

If you have an issue at runtime, include the required information below:

Traceback (most recent call last):
  File "looter-script.py", line 4, in <module>
    print(len(looter.medias()))
  File "/home/<>/venv/lib/python3.5/site-packages/instalooter/looters.py", line 332, in medias
    return self._medias(self.pages(), timeframe)
  File "/home/<>/venv/lib/python3.5/site-packages/instalooter/looters.py", line 724, in pages
    it = ProfileIterator.from_username(self._username, self.session)
  File "/home/<>/venv/lib/python3.5/site-packages/instalooter/pages.py", line 178, in from_username
    raise ValueError("user not found: '{}'".format(username))
ValueError: user not found: 'nike'

Profile Looter fails to find users when run on a hosted machine.

I can confirm, however, that the Hashtag looter works flawlessly.

BOTH looters work correctly on locally on Mac OSX.

The problem does not appear to be with my user-agent string—I can successfully handle retrieval using the ProfileLooter from a Docker container running Ubuntu latest.

Here is my user-agent string, as added to ~/.cache/instalooter/2.4.4/user-agent.txt:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36

Reproducible test case

Are you using the CLI ? If so, include a command that can be used to re-raise the error, with actual arguments anybody can try:

Steps to reproduce:
1) Create a free machine on GCP or AWS
2) Install instalooter
3) python -m instalooter user nike

Results in a user not found error, which is obviously incorrect, as Nike is a massive international brand.

Might Instagram be blocking GCP related IPs somehow?

Are you using the API ? If so, include a small snippet that can be used to re-raise the error:

from instalooter.looters import ProfieLooter
looter = ProfileLooter('nike')

Expected behaviour

User not found error is raised.

Actual behaviour

Account should be found and files downloaded.

take0ut commented 4 years ago

I've done a bit more digging and found that other instagram scraping tools fail on GCP. @althonos Have you run into this issue before? Is there native support for IP proxies in Instalooter?

take0ut commented 4 years ago

@althonos Any updates here? Instalooter has been nonfunctional for me for at least a month under the conditions above.

RiedleroD commented 3 years ago

seems to fix itself when you supply login credentials. Maybe Instagram does some gay magic on their side to detect unofficial access to their services, but I'm content with this solution. For anybody that doesn't know how to log in – this is probably not the best way to do it, but I found that this worked:

from instalooter.cli.login import login
login({"--username":"{username}","--password":"{password}","--quiet":False})

If there's a better way to log in, well, too bad.