21 lines
536 B
JavaScript
21 lines
536 B
JavaScript
|
function getImage(a) {
|
||
|
var regex = new RegExp(/^(?!.*\.\.)(?!.*\.$)[^\W][\w.]{0,29}$/);
|
||
|
var validation = regex.test(a);
|
||
|
|
||
|
if(validation) {
|
||
|
$.get("https://www.instagram.com/"+a+"/?__a=1")
|
||
|
.done(function(data) {
|
||
|
|
||
|
var imageURL = data["graphql"]["user"]["profile_pic_url_hd"];
|
||
|
|
||
|
$("#imageReturn").attr("src",imageURL)
|
||
|
|
||
|
})
|
||
|
.fail(function() {
|
||
|
alert('Nutzername wurde nicht gefunden!')
|
||
|
})
|
||
|
} else {
|
||
|
alert('Der Nutzername ist ungültig!')
|
||
|
}
|
||
|
}
|