subzeroid / instagrapi-rest

RESTful API Wrapper for Instagram Private API
https://hikerapi.com/p/ygXxF38v
MIT License
499 stars 128 forks source link

[BUG] Getting 'Unprocessable Entity' #38

Open FranciscoDadone opened 2 years ago

FranciscoDadone commented 2 years ago

Describe the bug I get Unprocessable Entity when passing usertags to upload a clip. (From NodeJS)

To Reproduce

const FormData = require('form-data');

const formData = new FormData();
formData.append('sessionid', sessionid);
  formData.append('caption', caption);
  formData.append('url', url);
  formData.append(
    'usertags',
    `{"user": {"pk": "${userInfo.pk}", "username": "${userInfo.username}", "full_name": "${userInfo.full_name}", "profile_pic_url": "${userInfo.profile_pic_url}", "profile_pic_url_hd": "${userInfo.profile_pic_url_hd}", "stories": []}, "x": 0, "y": 0}`
  );

fetch(`${process.env.INSTAGRAPI_URL}/clip/upload/by_url`, {
    method: 'POST',
    headers: formData.getHeaders(),
    body: formData,
  })

Traceback rcplanesglobalbot-webversion-instagrapi-1 | INFO: 172.23.0.3:44116 - "POST /clip/upload/by_url HTTP/1.1" 422 Unprocessable Entity

Expected behavior Upload the clip with the user tagged in it.

Desktop (please complete the following information):

Additional context If I remove

 formData.append(
    'usertags',
    `{"user": {"pk": "${userInfo.pk}", "username": "${userInfo.username}", "full_name": "${userInfo.full_name}", "profile_pic_url": "${userInfo.profile_pic_url}", "profile_pic_url_hd": "${userInfo.profile_pic_url_hd}", "stories": []}, "x": 0, "y": 0}`
  );

the clip uploads correctly but when I add the 'usertags' it gives me that error.