dilame / instagram-private-api

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

How to get reel url from a chat #1725

Open missnora07 opened 1 year ago

missnora07 commented 1 year ago

How to get a reel url from a chat

I want to obtain the reel URL or buffer from a shared reel in my chat. If a user sends me a new reel, I want to get that reel's URL.

1alind commented 1 year ago

as i know there is no way to get reel info from chat in this library... am not sure if this still works, but it used to work for me. good luck if (msgtype == "placeholder") { // cookies from browser session. u can use cookies from chrome firefox etc.. let h = JSON.parse(fs.readFileSync('./files/h' + uid + '.json', 'utf8')); try { const response = await axios.get("https://i.instagram.com/api/v1/direct_v2/threads/" + m.message.thread_id + "/get_items/?item_ids=%5B%22" + m.message.item_id + "%22%5D&original_message_client_contexts=%5B%22" + m.message.client_context + "%22%5D", { headers: h, body: null, method: "GET" }); let gh = await response.data; if (gh.toString()[0] != "[") { s("need web cookies") return } if (gh.items[0].item_type && gh.items[0].item_type == "clip") { let vl = gh.items[0].clip.clip.video_versions[0].url; sv(vl); // send video to user return; } else { sm("private account 😬?!"); // send message to user } } catch (e) { } }