If you spend a lot of time on instagram, and accounts you followed in the past seem irrelevant now, unfollow them makes the most sense.
Even if you don’t care about having a tight “follower to following ratio,” this is useful because it helps to unclutter your feed, ensuring that the content you scroll through is all stuff you want to see.
Unfortunately, Instagram doesn’t make it easy to do. you can Unfollow all manually one by one, but it will takes a lot of times and i am sure you wont be happy to do it.
NOTE:
This tutor works on english version of Instagram layout because this script search "Following" button,
the extension may not work in the future if Instagram changes their layout, in this case, you should subscribe my channel to get an update for the new script.
my youtube channel :
An easy way to do this is with the help of a chrome extension. here's a simple way to do it.
You only have to create 2 files, manifest.json and unfollow.js
1. manifest.json
copy the code below and paste it in to your manifest.json file:
{
"manifest_version": 2,
"name": "Instagram UnFollower - FreeAngel",
"description": "This extension will unfollow all instagram accounts",
"version": "1.0",
"content_scripts": [
{
"matches": ["https://*.instagram.com/*"],
"js": ["unfollow.js"]
}
]
}
This is just a metadata file in JSON format that contains properties like your extension’s name, description, version number and so on. Every extension needs to have a JSON-formatted manifest file.
2. unfollow.js
copy the code below and paste it in to your unfollow.js file:
/*
Simple script to unfollow all instagram account
(c) FreeAngel - 2021
http://www.youtube.com/channel/UC15iFd0nlfG_tEBrt6Qz1NQ
*/
const interval = 5000;
const wait_delay = 5;
const reload_after_unsub = 20;
instagram_following_page = '';
cur_tick = 0;
buttons = null;
btn_idx = 0;
no_subs = false;
infollowing_page = false;
inprofile_page = false;
var readyStateCheckInterval = setInterval(function() {
if (document.readyState === "complete") {
cur_tick += interval/1000;
DoJob();
console.log("timer ...");
}
}, interval);
function DoJob(){
if(cur_tick < wait_delay ) { console.log("waiting delay (10s) : "+cur_tick); return; }
if(no_subs) {
if (cur_tick >= 30) { console.log("reloading page ..."); window.location = instagram_following_page; }
return;
}
var cur_url = window.location.href;
if(cur_url.indexOf("instagram.com") == -1) { return; }
if(!IsInProfilePage()) { return; }
if(!infollowing_page){
if(cur_url.indexOf("following") != -1){
infollowing_page = true;
instagram_following_page = cur_url;
}
}
var b = IsDialogOpen();
if(!b) {
OpenDialog();
return ;
} else {
console.log("dialog is open");
}
var c = UnFollow();
if( c < 1) { no_subs = true; return; }
console.log("unfollow : "+c);
}
function IsInProfilePage(){
if(inprofile_page) { return true; }
var ar = document.getElementsByTagName('a');
var hr = '';
for(var i=0; i<ar.length; i++){
hr = ar[i].getAttribute('href');
if (hr.indexOf('accounts/edit/') != -1){
console.log("In Profile Page !");
inprofile_page = true;
return true;
}
}
return false;
}
function IsDialogOpen(){
var ar = document.querySelector('div[role="dialog"]');
if(ar){ return true; }
return false;
}
function OpenDialog(){
var ar = document.getElementsByTagName('a');
if(!ar) { return; }
var hr;
for(var i=0; i<ar.length; i++){
hr = ar[i].getAttribute("href");
if(!hr) { continue; }
if(hr.indexOf("/following/") == -1) { continue; }
ar[i].click();
console.log("opening dialog");
break;
}
}
function UnFollow(){
var ar = document.getElementsByTagName('button');
if(!ar) { return 0; }
var l;
var c = 0;
for(var i=0; i<ar.length; i++){
l = ar[i].textContent;
if(l.indexOf("Following") != -1){
ar[i].scrollIntoView();
ar[i].click();
c++;
setInterval(function(){
SubUnfollow();
},1000);
return c;
}
}
return c;
}
function SubUnfollow(){
var ar = document.getElementsByTagName('button');
if(!ar) { return; }
var l;
for(var i=0; i<ar.length; i++){
l= ar[i].textContent;
if(!l) { continue; }
if(l.indexOf("Unfollow") != -1){ ar[i].click(); return; }
}
}
put those two files into a directory, name the directory anything you want.
you can also download the complete files here :
https://drive.google.com/file/d/1r2Yc-ldrU5mR3RL6Cr5Ncg4BXBensvoQ/view?usp=sharing
CONNECT TO CHROME
Now we need to ..load the extension!
- Go to chrome://extensions in your browser
- Ensure that the Developer mode checkbox in the top right-hand
- Click Load unpacked extension to pop up a file-selection dialog & select your directory.
- If the extension is valid, it’ll be loaded up and active right away! If it’s invalid, an error message will be displayed at the top of the page. Correct the error, and try again.
- Ensure that the enabled box next to your chrome extension is checked so you can see it in action.
- Now you can go to : https://www.instagam.com, make sure you've logged in, go to your profile page, reload the page if nothing happen.
- Just Wait until it started to work
Post a Comment