Comments (4)
Would it be possibile to exclude some accounts I don't want to be auto-unfollowed? E.g. pages and such
I could customize the script a little bit to not unfollow certain users etc.. or to not unfollow account with higher follower count than X. If you are ok with that I will post here a modified script.
from instagramunfollowers.
from instagramunfollowers.
Yeah, both solutions would actually be appreciated for multiple use cases. Thank you!
I was only able to do it the first way, with a blacklist.
All the people in this blacklist wont be unfollowed.
To add some username to the blacklist just follow the example of username1,username2 etc..
To execute the script copy the code as always and paste it on the console.
(REMEMBER TO PUT THE USERNAME NOT THE NAME)
const ACCOUNT_USERNAME_BLACKLIST = [
"username1",
"username2",
"username3",
]
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
function afterUrlGenerator(nextCode) {
return `https://www.instagram.com/graphql/query/?query_hash=3dec7e2c57367ef3da3d987d89f9dbc8&variables={"id":"${ds_user_id}","include_reel":"true","fetch_mutual":"false","first":"24","after":"${nextCode}"}`;
}
function unfollowUserUrlGenerator(idToUnfollow) {
return `https://www.instagram.com/web/friendships/${idToUnfollow}/unfollow/`;
}
let csrftoken = getCookie("csrftoken");
let ds_user_id = getCookie("ds_user_id");
let initialURL = `https://www.instagram.com/graphql/query/?query_hash=3dec7e2c57367ef3da3d987d89f9dbc8&variables={"id":"${ds_user_id}","include_reel":"true","fetch_mutual":"false","first":"24"}`;
let doNext = true;
let followedPeople;
let filteredList = [];
let getUnfollowCounter = 0;
let scrollCicle = 0;
startScript();
async function startScript() {
while (doNext) {
let receivedData
try {
receivedData = await fetch(initialURL).then(res => res.json());
} catch (e) {
continue;
}
if (!followedPeople) {
followedPeople = receivedData.data.user.edge_follow.count;
}
doNext = receivedData.data.user.edge_follow.page_info.has_next_page;
initialURL = afterUrlGenerator(receivedData.data.user.edge_follow.page_info.end_cursor);
getUnfollowCounter += receivedData.data.user.edge_follow.edges.length;
receivedData.data.user.edge_follow.edges.forEach(x => {
if (!x.node.follows_viewer) {
filteredList.push(x.node);
}
})
console.clear();
console.log(`%c Progress ${getUnfollowCounter}/${followedPeople} (${parseInt((getUnfollowCounter / followedPeople) * 100)}%)`, 'background: #222; color: #bada55;font-size: 35px;');
console.log(`%c This users don't follow you (Still in progress)`, 'background: #222; color: #FC4119;font-size: 13px;');
filteredList.forEach(x => {
console.log(x.username);
})
await sleep(Math.floor(Math.random() * (1000 - 600)) + 1000);
scrollCicle++;
if (scrollCicle > 6) {
scrollCicle = 0;
console.log(`%c Sleeping 10 secs to prevent getting temp blocked`, 'background: #222; color: ##FF0000;font-size: 35px;');
await sleep(10000);
}
}
console.clear();
console.log(`%c ${filteredList.length} users don't follow you`, 'background: #222; color: #bada55;font-size: 25px;');
filteredList.forEach(x => {
console.log(x.username);
});
wantUnfollow = confirm("Do you want to unfollow this people we listed?");
if (wantUnfollow) {
let counter = 0;
unfollowSleepCounter = 0;
for (const x of filteredList) {
if (x.username && !ACCOUNT_USERNAME_BLACKLIST.includes(x.username)) {
try {
await fetch(unfollowUserUrlGenerator(x.id), {
"headers": {
"content-type": "application/x-www-form-urlencoded",
"x-csrftoken": csrftoken,
},
"method": "POST",
"mode": "cors",
"credentials": "include"
});
} catch (e) {
}
await sleep(Math.floor(Math.random() * (6000 - 4000)) + 4000);
counter++;
unfollowSleepCounter++;
if (unfollowSleepCounter >= 5) {
console.log(`%c Sleeping 5 minutes to prevent getting temp blocked`, 'background: #222; color: ##FF0000;font-size: 35px;');
unfollowSleepCounter = 0;
await sleep(300000)
}
console.log(`Unfollowed ${counter}/${filteredList.length}`)
}
}
console.log(`%c All DONE!`, 'background: #222; color: #bada55;font-size: 25px;');
} else {
console.log(`%c All DONE!`, 'background: #222; color: #bada55;font-size: 25px;');
}
}
from instagramunfollowers.
I'll close this issue for now. If you have any other question feel free to reopen it.
from instagramunfollowers.
Related Issues (20)
- Issue: Disabled 'Select All' Checkbox HOT 1
- Enhancement: Reduce time for -> Sleeping 5 minutes to prevent getting blocked HOT 7
- Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor' HOT 1
- (IDEA) Why not making a tool similiar for threads instead? HOT 3
- Cannot paste code in console HOT 14
- .. HOT 1
- When trying to paste the code: Can be used only on Instagram routes HOT 1
- no deja pegar el codigo en la consola HOT 4
- Preserve user list after unfollowing any
- Error 413
- . HOT 3
- Doesn't do anything HOT 4
- DIscord Token
- How to whitelist accounts HOT 2
- Select all button not working HOT 5
- How to edit sleeping time HOT 7
- EOL? HOT 8
- Safe to use? Maybe a workflow to generate the compressed code to index.html HOT 2
- Jejej
- It is safe? HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instagramunfollowers.