I'm trying to get a list of instagram accounts that I follow but they dont follow me back. Follow returns a list of people that I follow and followed does return a list of people that follow me. And I want to remove followed from follow to get all of those who dont follow me back. But filtering myArray doesn't change it's content. It seems like its elements are in different format so it cant compare them yet they are both arrays with usernames. I've tried many methods of filtering the list but they all give the same result.
EDIT: eg. of array is: 0: "xxx" 1: "yyy" 2: "zzz"
function follow(url){
var list=[];
var Httpreq = new XMLHttpRequest();
Httpreq.open("GET",url,false);
Httpreq.send(null);
var json_obj = JSON.parse(Httpreq.responseText);
for (const node of json_obj.data.user.edge_follow.edges) {
list.push(String(node.node.username));
}
return list;
}
function followed(url){
var list=[];
var Httpreq = new XMLHttpRequest();
Httpreq.open("GET",url,false);
Httpreq.send(null);
var json_obj = JSON.parse(Httpreq.responseText);
for (const node of json_obj.data.user.edge_followed_by.edges) {
list.push(String(node.node.username));
}
return list;
}
var myArray=new Array(follow(urlFollow));
wait(5000);
var toRemove=new Array(followed(urlFollowed));
var myArray = myArray.filter((item) => !toRemove.includes(item));
console.log(myArray)