instagram-private-api 在尝试在 Instagram 上发布图像时抛出错误

问题描述 投票:0回答:0
const IgApiClient = require('instagram-private-api').IgApiClient;
const fs = require('fs');
const config = require('./config.json');

const ig = new IgApiClient();
ig.state.generateDevice(config.instagramUsername);
ig.state.proxyUrl = config.igProxy;

async function uploadImage(imageBuffer) {
  const imageUrl = await ig.upload.photo(
    {
        file: imageBuffer
    }
  );
  console.log(`URL: ${imageUrl}`);
}

(async () => {
  await ig.simulate.preLoginFlow();
  const loggedInUser = await ig.account.login(config.instagramUsername, config.instagramPassword);
  process.nextTick(async () => await ig.simulate.postLoginFlow());

  const imageBuffer = fs.readFileSync('output.png');

  uploadImage(imageBuffer);
})();

错误:

C:\Users\PC\Desktop\spotted ode_modules\instagram-private-api\dis

node.js instagram instagram-api
© www.soinside.com 2019 - 2024. All rights reserved.