instagram-php-scraper icon indicating copy to clipboard operation
instagram-php-scraper copied to clipboard

Response code is 401: Unauthorized.Something went wrong. Please report issue.

Open Arish68 opened this issue 2 years ago • 12 comments

Working fine on localhost but on Production level it return an error Response code is 401: Unauthorized.Something went wrong. Please report issue.

Code Snippet: $instagram->getAccountInfo('username');

Arish68 avatar Nov 10 '22 12:11 Arish68

The same issue please someone help with this issue. Or please share more info about using a proxy server. my proxy server is also throwing the same error.

IrfanPatelDev avatar Nov 22 '22 12:11 IrfanPatelDev

@IrfanPatelDev use this code to fetch public userdata by username

$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client()); $nonPrivateAccountMedias = $instagram->getMedias('kevin'); echo $nonPrivateAccountMedias[0]->getLink();

kindly check example folder and i hope you will never use proxy server https://github.com/postaddictme/instagram-php-scraper/tree/master/examples

Arish68 avatar Nov 23 '22 07:11 Arish68

@IrfanPatelDev use this code to fetch public userdata by username

$instagram = new \InstagramScraper\Instagram(new \GuzzleHttp\Client()); $nonPrivateAccountMedias = $instagram->getMedias('kevin'); echo $nonPrivateAccountMedias[0]->getLink();

kindly check example folder and i hope you will never use proxy server https://github.com/postaddictme/instagram-php-scraper/tree/master/examples Thanks @Arish68 for your reply, I tried this but still no luck :(

IrfanPatelDev avatar Nov 23 '22 12:11 IrfanPatelDev

I have same problem. On localhost works but on production server i haven't authorization. I'm using proxy.

fverdicchio avatar Nov 27 '22 13:11 fverdicchio

All these problems are related to the proxy, that is why it works on your local connection because you are using your telecom connection which is a residential connection.

You may buy a proxy but it is very expansive, each 1 GB of traffic = 25 UDS. if any one is interested in this type of proxy you can contact me.

Regards

beshoo avatar Nov 30 '22 01:11 beshoo

im using proxy, using this library one year, in last 10 days, only getmedias showing error 401. I change the proxy to rotating, not sticky and all is ok now

brucekasinsky avatar Dec 05 '22 06:12 brucekasinsky

@brucekasinsky please explain your solution (proxy to rotating)

Arish68 avatar Dec 05 '22 12:12 Arish68

@Arish68

First you have to get a good proxy, for me the only one i get working with facebook is smartproxy, residencial plan. I test like five and have the problem with 401 error. There are option to use sticky and rotating.

The main difference between sticky and rotating proxies is that a sticky proxy associates a single IP address per user request while a rotating proxy assigns various IP addresses for each new request.

brucekasinsky avatar Dec 05 '22 15:12 brucekasinsky

Same here... same using this rotating proxy

fabioselau077 avatar Feb 02 '23 01:02 fabioselau077

Everything was working, and then I keep getting 401 Unauthorized. Is it some kind of ban by Instagram? How this can be fixed?

MJRamon avatar Feb 19 '23 18:02 MJRamon

Use a proxy service. Instagram bans IPS if it defects unusual activity from them.

On Sun, 19 Feb 2023, 18:28 MJRamon, @.***> wrote:

Everything was working, and then I keep getting 401 Unauthorized. Is it some kind of ban by Instagram? How this can be fixed?

— Reply to this email directly, view it on GitHub https://github.com/postaddictme/instagram-php-scraper/issues/1104#issuecomment-1436059575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXC3UDK2BKU643IWPAN7VDWYJQ3JANCNFSM6AAAAAAR4QWNJ4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jhob101 avatar Feb 19 '23 18:02 jhob101

I am now using https://rapidapi.com/neotank/api/instagram130/ and they somehow manage to download account json info (I am using /account-info endpoint of this api and it returns basic account info and 12 latest posts in JSON) - and they do not require to supply any cookies or login info - but this is a paid API.. it's still cheaper than purchase very expensive proxies per GB tho

skmachine avatar Apr 26 '23 15:04 skmachine