dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.93k stars 1.14k forks source link

Bad Request, Missing Info #1299

Open r4zendev opened 3 years ago

r4zendev commented 3 years ago

Bug Report

Form

Requirements

Description

Apparently when I try to await ig.media.configure it throws Bad Request for not providing info. I provide the required param to the function (upload_id) and the caption i'd like to set for the post. I think the types are incorrect since there is no other info required.

Code

const fetchAndUpdate = async (postId: string) => {
  await Bluebird.try(async () => {
    const postInfo = await ig.media.info(postId);
    const {
      like_count: likeCount,
      comment_count: commentCount,
    } = postInfo.items[0];
    console.log(likeCount, commentCount);
    const newDesc = `19 yo Fullstack JS Developer\nLikes: ${likeCount}\nComments: ${commentCount}`;
    const response = await ig.media.configure({
      upload_id: postId,
      caption: newDesc,
    });
    console.log(response);
  }).catch(IgResponseError, async (err) => {
    console.log(err);
    if (fetchInterval) clearInterval(fetchInterval);
    await sleep(120000);
    fetchInterval = setInterval(() => {
      fetchAndUpdate(postId);
    }, 1000 * 60);
  });
};

Error and Output

IgResponseError: POST /api/v1/media/configure/ - 400 Bad Request; Missing info.
1|instupd  |     at Request.handleResponseError (/var/www/html/fun/node_modules/instagram-private-api/dist/core/request.js:125:16)
1|instupd  |     at Request.send (/var/www/html/fun/node_modules/instagram-private-api/dist/core/request.js:53:28)
1|instupd  |     at async MediaRepository.configure (/var/www/html/fun/node_modules/instagram-private-api/dist/repositories/media.repository.js:223:26)
r4zendev commented 3 years ago

Ok, I realized I seem to be using the wrong method. editMedia is what I need I suppose... But then, what is the purpose of configure? Is there a better documentation with description being planned to be released any time soon? Sorry for bothering. The label has to be changed.