Skip to content

Instantly share code, notes, and snippets.

@Sansekai
Created August 6, 2023 12:18
Show Gist options
  • Save Sansekai/4a323b5c3661f650094a752cb063a60d to your computer and use it in GitHub Desktop.
Save Sansekai/4a323b5c3661f650094a752cb063a60d to your computer and use it in GitHub Desktop.
const axios = require("axios");
const cheerio = require("cheerio")
async function start() {
const headers = {
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'origin': 'https://idownloader.io',
'referer': 'https://idownloader.io/',
'cookie': 'PHPSESSID=easqd0d1ujiqf1arv4rsfm7jmd; _ga=GA1.1.1541970967.1691152140; __gads=ID=73d79b0404953e47-2265a0e8ace2005b:T=1691152143:RT=1691152143:S=ALNI_MZYOVK4CvhzBgX5BuYv0sXZH0dxqw; __gpi=UID=00000c26fe06658f:T=1691152143:RT=1691152143:S=ALNI_MbRhScE7mqlyPm-7jogXzFURPIFBA; _ga_6ZBFDSJZBL=GS1.1.1691152139.1.1.1691152367.60.0.0'
};
const url = "https://www.instagram.com/p/CvcydWguxr8/?igshid=MzRlODBiNWFlZA=="
const data = `url=${url}&host=instagram`;
const resp = await axios.post('https://idownloader.io/core/ajax.php', data, { headers })
//console.log(resp.data);
const $ = cheerio.load(resp.data);
const links = [];
$('a').each((index, element) => {
links.push($(element).attr('href'));
});
for (let resu of links) {
const res = `https://idownloader.io/${resu}`;
console.log(res)
}
}
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment