Instagram-Downloader
Instagram-Downloader copied to clipboard
Cannot read property 'shortcode_media' of undefined
Hi, i could run your script to get videos on my local mac, and everything was so good. but when i deployed my code on my ubuntu vps, it gets following error:
Error happened in the submitPost , function: TypeError: Cannot read property 'shortcode_media' of undefined at getMediaType (/root/addNewSongTelegramBot/node_modules/@juliendu11/instagram-downloader/index.js:11:17) at Object.downloadMedia (/root/addNewSongTelegramBot/node_modules/@juliendu11/instagram-downloader/index.js:85:19) at process._tickCallback (internal/process/next_tick.js:68:7)
and here is my code:
const fs = require('fs');
const instagram_download = require('@juliendu11/instagram-downloader');
const { deleteFile } = require('./DeleteFile');
const instagramPostDownloader = async (url, fileName) => {
console.log(url);
console.log(fileName);
const value = await instagram_download.downloadMedia(url, './dl/');
const orgPostFilePath = './dl/' + value.file.split('/').pop();
const newPostFilePath = './dl/' + fileName + '.mp4';
fs.renameSync(orgPostFilePath, newPostFilePath);
await deleteFile(value.thumbnail);
return newPostFilePath;
};
module.exports = { instagramPostDownloader };
and this is url of instagram video post: https://www.instagram.com/p/CRY1joKgNC-/
could you please help me with this one?
same error
2021-09-26T18:53:49.012490+00:00 app[web.1]: TypeError: Cannot read property 'shortcode_media' of undefined 2021-09-26T18:53:49.012500+00:00 app[web.1]: at getMediaType (/app/node_modules/@juliendu11/instagram-downloader/index.js:11:17)
I think it is because of Axios request. Any fix?
I think it's because instagram is not public anymore and you have to be logged in to take videos and images out of it. Maybe you can login once and use auth key to remain logged in, then use this repo to download.