I prepared a small site which download photos from instagram. I found a jpg link in the source code, but i don't know how to translate it to link for download.
I also want to download link immediately after finding (not a click event). My current code:
function link()
{
for (var i= licznik;i<data.length;i++) //data is a response text(XMLHTTP)
{
kod=kod+data[i];
if(data[i+2]== " ")
{
console.log(kod); //it works(returning correct url for example: https://something.jpg)
Pobierz(); // this function has to call a download
break;
}
}
console.log(kod);
}
function Pobierz()
{
var link;
link.href = string(kod); // error
link.click(); // i don't want onclick - it has to be downloaded when function is called
}