instagram_private_api icon indicating copy to clipboard operation
instagram_private_api copied to clipboard

error Bad Request

Open eduardoegos opened this issue 5 years ago • 36 comments

Please follow the guide below

  • Issues submitted without this template format will be ignored.
  • Rlease read them carefully and answer completely.
  • Do not post screenshots of error messages or code.
  • Put an x into all the boxes [ ] relevant to your issue (==> [x] no spaces).
  • Use the Preview tab to see how your issue will actually look like.
  • Issues about reverse engineering is out of scope and will be closed without response.
  • Any mention of spam-like actions or spam-related tools/libs/etc is strictly not allowed.

Before submitting an issue, make sure you have:

  • [x ] Updated to the lastest version v1.6.0
  • [x ] Read the README and docs
  • [x ] Searched the bugtracker for similar issues including closed ones
  • [x ] Reviewed the sample code in tests and examples

Which client are you using?

  • [x ] app (instagram_private_api/)
  • [ ] web (instagram_web_api/)

Describe your Question/Issue:

Please make sure the description is worded well enough to be understood with as much context and examples as possible.

Hi, i've been usign this api for a few months now, i use it to schedule posts directly from my pc, all has been working fine until today. i'm getting a "Bad request" error, seems to be different from the usual instagram blocks, a friend of mine uses the same code and it also stopped working today. Instagram changed some stuff in the last update, could that be it? Is someone else having issues posting as well?


Paste the output of python -V here: Python 3.7.3

Code:

def new_photo(api,photo,caption,loc,com,page_id):
	
	photo_data = open(photo, "rb").read()
	size = (1080, 1080)

	try:
		post = api.post_photo(photo_data, size=size, caption=caption, location=loc)
		print("\nPostado no Instagram!")
	except Exception as e:
		print("ALGO DEU ERRADO NA POSTAGEM!\n" + str(e))
		print ("Tentando de novo...")
		wait_for(30)
		print ("Nova tentativa:")
		post = api.post_photo(photo_data, size=size, caption=caption, location=loc)
		print("\nPostado no Instagram!")

Error/Debug Log:

Error parsing error response: Expecting value: line 1 column 1 (char 0) ALGO DEU ERRADO NA POSTAGEM! Bad Request

eduardoegos avatar Oct 29 '19 21:10 eduardoegos

Getting the same error for about 23 hours.

spctra avatar Oct 30 '19 12:10 spctra

Most private instagram api's have similar problems for the last 2 days. Maybe Instagram is chancing something.

hoemon avatar Oct 30 '19 13:10 hoemon

:/

hoemon avatar Oct 30 '19 15:10 hoemon

I'm having the same issue as well. Has anyone found a fix?

ghost avatar Oct 31 '19 08:10 ghost

Same here. Tried multiple proxies / residential IP's and different private API's. IG defnitly changed something...

iloveautomation avatar Oct 31 '19 13:10 iloveautomation

seems to be working again for me. i'm a little scared to keep using it though, does someone know what happened? i heard some people are getting blocked permanently

eduardoegos avatar Nov 05 '19 13:11 eduardoegos

yes this is working again, any news why ?

ig said they had closed this endpoint for good.. changed their mind ?

steffanjensen avatar Nov 05 '19 13:11 steffanjensen

and it stopped again...

eduardoegos avatar Nov 19 '19 15:11 eduardoegos

parou mesmo

luizolimpio avatar Nov 20 '19 19:11 luizolimpio

and it stopped again... 2

luizolimpio avatar Nov 20 '19 19:11 luizolimpio

any news on this?

eduardoegos avatar Nov 30 '19 19:11 eduardoegos

This also happens to me. Maybe wrong headers?

trocotronic avatar Dec 16 '19 09:12 trocotronic

I need this solved ASAP.

William04A avatar Dec 16 '19 19:12 William04A

I have the same error when I upload a photo. I am on Python 3.8, Linux Manjaro :

` warnings.warn('This endpoint has not been fully tested.', UserWarning) Error parsing error response: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/instagram_private_api/endpoints/upload.py", line 446, in post_photo response = self.opener.open(req, timeout=self.timeout) File "/usr/lib/python3.8/urllib/request.py", line 531, in open response = meth(req, response) File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response response = self.parent.error( File "/usr/lib/python3.8/urllib/request.py", line 569, in error return self._call_chain(*args) File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 400: Bad Request

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./instagram.py", line 12, in api.post_photo(photo_data, photo_size, caption='Hello World!') File "/usr/lib/python3.8/site-packages/instagram_private_api/endpoints/upload.py", line 450, in post_photo ErrorHandler.process(e, error_response) File "/usr/lib/python3.8/site-packages/instagram_private_api/errors.py", line 141, in process raise ClientError(error_msg, http_error.code, error_response) instagram_private_api.errors.ClientError: Bad Request `

hamdyaea avatar Dec 27 '19 22:12 hamdyaea

I tried this package and tried php package from mgp25(it worked till oct. 2019, but now has same issue: 400 bad request).

ps: NodeJS package work fine for me

acrossoffwest avatar Jan 06 '20 12:01 acrossoffwest

@acrossoffwest could you give a link to a NodeJS package? I am going to try to compare requests between these two packages. Maybe I will be able to figure out the problem.

botsman avatar Jan 08 '20 17:01 botsman

@pbotsman instagram-private-api

acrossoffwest avatar Jan 08 '20 17:01 acrossoffwest

In this time the post_photo method is working or not ? for me this is return Bad Request help me guys ASAP

ghost avatar Jan 18 '20 06:01 ghost

@pbotsman any progress?

discotroll65 avatar Jan 31 '20 07:01 discotroll65

@discotroll65 no luck 😞

botsman avatar Jan 31 '20 07:01 botsman

any news on this?

eduardoegos avatar Feb 11 '20 21:02 eduardoegos

safe to say this api is dead?

eduardoegos avatar Mar 08 '20 01:03 eduardoegos

curl 'https://www.instagram.com/rupload_igphoto/fb_uploader_1557924189090' 
-H 'cookie: mid=XNvymQAEAAFb4YRR4JkElxTB8I2_; csrftoken=IEpfr1jO1kB4EOFblQE285c9h5vD1LSh; ds_user_id=12828973541; sessionid=12828973541%3AXYcFYbRfWuitX7%3A23; rur=FRC; urlgen="{\"83.242.226.146\": 8359}:1hQtFJ:UiVB7Sl3c0NxnZh7VB9XujhuDGc"' 
-H 'origin: https://www.instagram.com' 
-H 'accept-encoding: gzip, deflate, br' 
-H 'accept-language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7' 
-H 'user-agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1' 
-H 'x-requested-with: XMLHttpRequest' 
-H 'x-csrftoken: IEpfr1jO1kB4EOFblQE285c9h5vD1LSh' 
-H 'x-ig-app-id: 1217981644879628' 
-H 'x-entity-name: fb_uploader_1557924189090' 
-H 'offset: 0' 
-H 'x-instagram-ajax: 748957cebea4' 
-H 'content-type: image/jpeg' 
-H 'accept: */*' 
-H 'authority: www.instagram.com' 
-H 'x-instagram-rupload-params: {"media_type":1,"upload_id":"1557924189090","upload_media_height":1080,"upload_media_width":1079}' 
-H 'x-entity-length: 16620' 
-H 'referer: https://www.instagram.com/create/details/'
--data-binary $'ÿØÿà\u00\u10JFIF\u00\u01\u01\u00\u00\u01\u00\................. --compressed ;

The problem is with the endpoin being used in the library. The above curl request seems to be working....so to make the upload method work again, the endpoint needs to be updated.

Suleman-Elahi avatar Mar 15 '20 12:03 Suleman-Elahi

Do you know how to do this? Can you make a pull request?

eduardoegos avatar Mar 16 '20 01:03 eduardoegos

Still can't upload photo :(


/usr/local/lib/python3.7/site-packages/instagram_private_api/endpoints/upload.py:397: UserWarning: This endpoint has not been fully tested.
  warnings.warn('This endpoint has not been fully tested.', UserWarning)
WARNING:instagram_private_api.errors:Error parsing error response: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/instagram_private_api/endpoints/upload.py", line 446, in post_photo

cyb3rsalih avatar Mar 19 '20 11:03 cyb3rsalih

@eduardoegos I don't have to time to inspect the uploader function, meanwhile, you can use the Instabot that is uploaded here: https://github.com/MessiDaGod/instabot-master

Upload example:

from instabot import Bot

bot = Bot()
bot.login(username="UserName", password="Password")
bot.upload_photo("custom.jpg", caption="Nice pic!")
print("OK")

Suleman-Elahi avatar Mar 19 '20 13:03 Suleman-Elahi

I think the problem is that there is no User-Agent...

AsafFisher avatar Apr 16 '20 13:04 AsafFisher

Did anyone get some progress? I was seeing and looks like this library just works with Python 2.7 and beta 3.5. https://github.com/ping/instagram_private_api

gpsanches avatar Jun 29 '20 08:06 gpsanches

@Suleman-Elahi

@eduardoegos I don't have to time to inspect the uploader function, meanwhile, you can use the Instabot that is uploaded here: https://github.com/MessiDaGod/instabot-master

Upload example:

from instabot import Bot

bot = Bot()
bot.login(username="UserName", password="Password")
bot.upload_photo("custom.jpg", caption="Nice pic!")
print("OK")

Hey?? This repo is archived! Did you use this code? Did you get any ban from Instagram?

runetech0 avatar Aug 03 '20 13:08 runetech0

https://github.com/MessiDaGod/instabot-master

That don't work for me :

hamdy@hamdy-pc ~/Documents/instabot-master   master  python test.py

Traceback (most recent call last): File "test.py", line 3, in from instabot import Bot File "/home/hamdy/Documents/instabot-master/instabot/init.py", line 2, in from .bot import Bot File "/home/hamdy/Documents/instabot-master/instabot/bot/init.py", line 1, in from .bot import Bot File "/home/hamdy/Documents/instabot-master/instabot/bot/bot.py", line 15, in from .state.bot_state import BotState ModuleNotFoundError: No module named 'instabot.bot.state'

hamdyaea avatar Aug 03 '20 16:08 hamdyaea

https://github.com/MessiDaGod/instabot-master

I tried this and It works. But I am not sure if we use it continuously, So Instagram will detect it and ban the account or not. Have anyone tried it for a long time? Did anyone experience a ban from Instagram using this bot code?

runetech0 avatar Aug 03 '20 17:08 runetech0

https://github.com/MessiDaGod/instabot-master

I tried this and It works. But I am not sure if we use it continuously, So Instagram will detect it and ban the account or not. Have anyone tried it for a long time? Did anyone experience a ban from Instagram using this bot code?

Well if you abuse the endpoints then you will definitely get banned.

Suleman-Elahi avatar Aug 03 '20 17:08 Suleman-Elahi

https://github.com/MessiDaGod/instabot-master I tried this and It works. But I am not sure if we use it continuously, So Instagram will detect it and ban the account or not. Have anyone tried it for a long time? Did anyone experience a ban from Instagram using this bot code?

Well if you abuse the endpoints then you will definitely get banned.

I just want to use it to upload photos to Instagram. Is it fine to hit the endpoint 6-7 time in an hour? Or is it too much or less?

runetech0 avatar Aug 03 '20 18:08 runetech0

https://github.com/MessiDaGod/instabot-master I tried this and It works. But I am not sure if we use it continuously, So Instagram will detect it and ban the account or not. Have anyone tried it for a long time? Did anyone experience a ban from Instagram using this bot code?

Well if you abuse the endpoints then you will definitely get banned.

I just want to use it to upload photos to Instagram. Is it fine to hit the endpoint 6-7 time in an hour? Or is it too much or less?

Ideally it shouldn't. But never used by myself so can't say.

Suleman-Elahi avatar Aug 04 '20 11:08 Suleman-Elahi

Any updates??

nickordoodle avatar Jun 04 '21 04:06 nickordoodle

I guess theres a request limit cause I'm not able to login in the specific account

Aaris-Kazi avatar Nov 13 '21 13:11 Aaris-Kazi