en
afsqam ar hy az eu be bn bs bg ca ceb ny zh-CN zh-TWco hr cs da nl en eo et tl fi fr fy gl ka de el gu ht ha haw iw hi hmn hu is ig id ga it ja jw kn kk km ko ku ky lo la lv lt lb mk mg ms ml mt mi mr mn my ne no ps fa pl pt pa ro ru sm gd sr st sn sd si sk sl so es su sw sv tg ta te th tr uk ur uz vi cy xh yi yo zu
Newsletter
Victor Mochere
No Result
View All Result
  • Wealth
    Top 10 richest green billionaires in the world

    Top 10 richest green billionaires in the world 2021

    Top 10 richest crypto billionaires in the world

    Top 10 richest crypto billionaires in the world 2021

    Top 10 richest musicians in Africa

    Top 10 richest musicians in Africa 2021

    Top 10 richest musicians in East Africa

    Top 10 richest musicians in East Africa 2021

    Akothee Net Worth

    Akothee Net Worth 2021

    Top 10 richest musicians in Kenya

    Top 10 richest musicians in Kenya 2021

    Top 10 richest musicians in Nigeria

    Top 10 richest musicians in Nigeria 2021

    Top 10 richest musicians in South Africa

    Top 10 richest musicians in South Africa 2021

    Top 10 richest musicians in Tanzania

    Top 10 richest musicians in Tanzania 2021

    Top 10 richest musicians in Ghana

    Top 10 richest musicians in Ghana 2021

  • Business
    How to safeguard your role as a company founder

    How to safeguard your role as a company founder

    Top 10 highest paid CEOs in Kenya

    Top 10 highest paid CEOs in Kenya 2021

    Best quotes from Warren Buffett

    Best quotes from Warren Buffett

    Top 10 largest ship-owning countries in the world

    Top 10 largest ship-owning countries in the world 2021

    Top 100 most valuable companies in Africa

    Top 100 most valuable companies in Africa 2021

    Top 20 most valuable companies in Southern Africa

    Top 20 most valuable companies in Southern Africa 2021

    Top 20 most valuable companies in North Africa

    Top 20 most valuable companies in North Africa 2021

    Top 20 most valuable companies in West Africa

    Top 20 most valuable companies in West Africa 2021

    Top 20 most valuable companies in East Africa

    Top 20 most valuable companies in East Africa 2021

    Top 10 most valuable companies in Kenya

    Top 10 most valuable companies in Kenya 2021

  • Education
    Best quotes from Friedrich Nietzsche

    Best quotes from Friedrich Nietzsche

    Effective strategies for academic writing

    Effective strategies for academic writing

    Best quotes from Adam Smith

    Best quotes from Adam Smith

    Top 10 best universities in the United States

    Top 10 best universities in the United States 2021

    Top 10 best universities in the United Kingdom

    Top 10 best universities in the United Kingdom 2021

    Top 20 hardest colleges to get into in the US

    Top 20 hardest colleges to get into in the US 2021

    Top 20 hardest universities to get into in the UK

    Top 20 hardest universities to get into in the UK 2021

    Best quotes from Marie Curie

    Best quotes from Marie Curie

    Best quotes from Galileo Galilei

    Best quotes from Galileo Galilei

    Top 10 most illiterate countries in Africa

    Top 10 most illiterate countries in Africa 2021

  • Travel
    How to prevent a catalytic converter from clogging

    How to prevent a catalytic converter from clogging

    Top 10 exotic dishes and restaurants in Dubai

    Top 10 exotic dishes and restaurants in Dubai 2021

    Things to consider when buying a car

    Things to consider when buying a car

    Things to consider when buying a travel camera

    Things to consider when buying a travel camera

    Top 10 car accessories that make your car fully loaded

    Top 10 car accessories that make your car fully loaded

    Nicaraguan passport Visa Free countries

    Nicaraguan passport Visa Free countries 2021

    Bolivian passport Visa Free countries

    Bolivian passport Visa Free countries 2021

    Moldovan passport Visa Free countries

    Moldovan passport Visa Free countries 2021

    Maldivan passport Visa Free countries

    Maldivan passport Visa Free countries 2021

    Georgian passport Visa Free countries

    Georgian passport Visa Free countries 2021

  • Technology
    3 digital technologies: How people learn

    3 digital technologies: How people learn

    Computer keyboard shortcuts you need to know

    Computer keyboard shortcuts you need to know

    What you need to know about Digital Service Tax in Kenya

    What you need to know about Digital Service Tax in Kenya

    Top 10 best website speed test tools

    Top 10 best website speed test tools 2021

    How to get verified on Triller

    How to get verified on Triller 2021

    Top 20 most liked tweets

    Top 20 most liked tweets 2021

    How to get your website included on Microsoft News

    How to get your website included on Microsoft News

    Top 10 best email apps

    Top 10 best email apps 2021

    How to tell if a laptop is new or used

    How to tell if a laptop is new or used

    How to tell if a laptop is new or refurbished

    How to tell if a laptop is new or refurbished

  • Living
    Best happy birthday wishes to yourself

    Best happy birthday wishes to yourself

    Best happy birthday quotes

    Best happy birthday quotes

    Best happy birthday wishes

    Best happy birthday wishes

    Best quotes from C. S. Lewis

    Best quotes from C. S. Lewis

    How to save money

    How to save money

    The process of a Muslim funeral

    The process of a Muslim funeral

    Essential herbs for building muscles

    Essential herbs for building muscles

    Factors affecting your YouTube revenue

    Factors affecting your YouTube revenue

    How to choose the right bank for your financial needs

    How to choose the right bank for your financial needs

    How to conceive a baby boy

    How to conceive a baby boy

  • Entertainment
    Best quotes from Adele

    Best quotes from Adele

    Best apps and games on App Store

    Best apps and games on App Store 2021

    Best apps and games on Google Play Store

    Best apps and games on Google Play Store 2021

    Top 20 best-selling singles of all time

    Top 20 best-selling singles of all time 2021

    Top 20 best-selling albums of all time

    Top 20 best-selling albums of all time 2021

    Top 20 best-selling music artists of all time by singles

    Top 20 best-selling music artists of all time by singles 2021

    Top 20 best-selling music artists of all time by albums

    Top 20 best-selling music artists of all time by albums 2021

    Top 20 best-selling music artists of all time

    Top 20 best-selling music artists of all time 2021

    Top 10 highest paid dead celebrities in the world

    Top 10 highest paid dead celebrities in the world 2021

    Top 10 most watched TV stations in Kenya

    Top 10 most watched TV stations in Kenya 2021

  • Governance
    Best quotes from Kamala Harris

    Best quotes from Kamala Harris

    Best quotes from Joe Biden

    Best quotes from Joe Biden

    Top 10 worst US presidents in history

    Top 10 worst US presidents in history 2021

    Top 10 best US presidents in history

    Top 10 best US presidents in history 2021

    Best quotes from Ronald Reagan

    Best quotes from Ronald Reagan

    Top 20 US presidents with the most electoral college votes

    Top 20 US presidents with the most electoral college votes 2021

    US presidential elections in which the winner lost the popular vote

    US presidential elections in which the winner lost the popular vote

    Top 20 US presidential candidates with the most popular votes

    Top 20 US presidential candidates with the most popular votes 2021

    Best quotes from Eleanor Roosevelt

    Best quotes from Eleanor Roosevelt

  • Sports
    Top 10 highest paid NBA players

    Top 10 highest paid NBA players 2021

    Best quotes from Lewis Hamilton

    Best quotes from Lewis Hamilton

    Top 10 greatest NBA players of all time

    Top 10 greatest NBA players of all time 2021

    Top 10 best NBA teams of all time

    Top 10 best NBA teams of all time 2021

    Best quotes from Diego Maradona

    Best quotes from Diego Maradona

    Top 10 countries with the most Olympic medals in Africa

    Top 10 countries with the most Olympic medals in Africa 2021

    Top 20 countries with the most Olympic medals

    Top 20 countries with the most Olympic medals 2021

    Top 10 most expensive football players in the world

    Top 10 most expensive football players in the world 2021

    Top 20 highest rated players in FIFA

    Top 20 highest rated players in FIFA 21

    Top 10 highest rated women players in FIFA

    Top 10 highest rated women players in FIFA 21

  • Life Hacks
    How to view a cached version of a website

    How to view a cached version of a website

    How to transfer WhatsApp chats to Telegram

    How to transfer WhatsApp chats to Telegram

    How to transfer WhatsApp chats to Signal

    How to transfer WhatsApp chats to Signal

    How to grow your YouTube channel quickly

    How to grow your YouTube channel quickly

    How to make money on YouTube

    How to make money on YouTube

    How to install WordPress on cPanel

    How to install WordPress on cPanel

    How to enable hotlink protection

    How to enable hotlink protection

    How to block an IP address on cPanel

    How to block an IP address on cPanel

    How to avoid a hangover

    How to avoid a hangover

    Top 20 countries with the most Nobel Prizes

    Top 20 countries with the most Nobel Prizes 2021

en
afsqam ar hy az eu be bn bs bg ca ceb ny zh-CN zh-TWco hr cs da nl en eo et tl fi fr fy gl ka de el gu ht ha haw iw hi hmn hu is ig id ga it ja jw kn kk km ko ku ky lo la lv lt lb mk mg ms ml mt mi mr mn my ne no ps fa pl pt pa ro ru sm gd sr st sn sd si sk sl so es su sw sv tg ta te th tr uk ur uz vi cy xh yi yo zu
Victor Mochere
No Result
View All Result
en
afsqam ar hy az eu be bn bs bg ca ceb ny zh-CN zh-TWco hr cs da nl en eo et tl fi fr fy gl ka de el gu ht ha haw iw hi hmn hu is ig id ga it ja jw kn kk km ko ku ky lo la lv lt lb mk mg ms ml mt mi mr mn my ne no ps fa pl pt pa ro ru sm gd sr st sn sd si sk sl so es su sw sv tg ta te th tr uk ur uz vi cy xh yi yo zu
Victor Mochere
No Result
View All Result

How to mass follow or unfollow people on Twitter 2021

Victor Mochere by Victor Mochere
in Life Hacks
Reading Time: 5min read
A A
0
How to mass follow or unfollow people on Twitter

Ever wanted to follow or unfollow people on Twitter aggressively without the hassle of clicking individual follow/unfollow buttons? Below are the codes you can use to mass follow or mass unfollow people on Twitter. But remember to use these Twitter follow/unfollow scripts for your own personal use/testing and respect Twitter rights.

Contents

  • Twitter mass follow script
  • Twitter mass unfollow script

Twitter mass follow script

To run Twitter mass follow script you have to use Chrome browser.

  1. Open Twitter and login to your account
  2. Open someone’s profile
  3. Click on Followers and you’ll see the list of people who are following your chosen profile
  4. Scroll down few times to load more profiles to the list
  5. Press SHIFT + CTRL + I (Windows) or CMD + OPT + I (Mac) on your keyboard or right click anywhere on the browser and select ‘Inspect Element’ or click on Chrome menu icon at the top-right corner of your browser window and then go to More tools > Developer Tools
  6. Select second tab ‘Console’
  7. Copy and paste this code and press ‘Enter’
$('.js-follow-btn').each(function(){ $(this).trigger('click'); }); 

Twitter mass unfollow script

To run Twitter mass unfollow script you have to use Chrome browser.

  1. Open Twitter and login to your account
  2. Click on Following and you’ll see the list of people who you’re following
  3. Scroll down few times to load more profiles to the list
  4. Press SHIFT + CTRL + I (Windows) or CMD + OPT + I (Mac) on your keyboard or right click anywhere on the browser and select ‘Inspect Element’ or click on Chrome menu icon at the top-right corner of your browser window and then go to More tools > Developer Tools
  5. Select second tab ‘Console’

a. Unfollow those not following back

5. To unfollow all those people who are not following you back, then copy and paste this code to console and press ‘Enter’

var LANGUAGE = "EN"; //NOTE: change it to use your language!
var WORDS =
{
	//English language:
	EN:
	{
		followsYouText: "Follows you", //Text that informs that follows you.
		followingButtonText: "Following", //Text of the "Following" button.
		confirmationButtonText: "Unfollow" //Text of the confirmation button. I am not totally sure.
	},
	//Spanish language:
	ES:
	{
		followsYouText: "Te sigue", //Text that informs that follows you.
		followingButtonText: "Siguiendo", //Text of the "Following" button.
		confirmationButtonText: "Dejar de seguir" //Text of the confirmation button. I am not totally sure.
	}
	//NOTE: if needed, add your language here...
}
var UNFOLLOW_FOLLOWERS = false; //If set to true, it will also remove followers (unless they are skipped).
var MS_PER_CYCLE = 10; //Milliseconds per cycle (each call to 'performUnfollow').
var MAXIMUM_UNFOLLOW_ACTIONS_PER_CYCLE = null; //Maximum of unfollow actions to perform, per cycle (each call to 'performUnfollow'). Set to 'null' to have no limit.
var MAXIMUM_UNFOLLOW_ACTIONS_TOTAL = null; //Maximum of unfollow actions to perform, in total (among all calls to 'performUnfollow'). Set to 'null' to have no limit.
var SKIP_USERS = //Users that we do not want to unfollow (even if they are not following you back):
[
	//Place the user names that you want to skip here (they will not be unfollowed):
	"user_name_to_skip_example_1",
	"user_name_to_skip_example_2",
	"user_name_to_skip_example_3"
];
SKIP_USERS.forEach(function(value, index) { SKIP_USERS[index] = value.toLowerCase(); }); //Transforms all the user names to lower case as it will be case insensitive.

var _UNFOLLOWED_TOTAL = 0; //Keeps the number of total unfollow actions performed. Read-only (do not modify).

//Function that unfollows non-followers on Twitter:
var performUnfollow = function(followsYouText, followingButtonText, confirmationButtonText, unfollowFollowers, maximumUnfollowActionsPerCycle, maximumUnfollowActionsTotal)
{
	var unfollowed = 0;
	followsYouText = followsYouText || WORDS.EN.followsYouText; //Text that informs that follows you.
	followingButtonText = followingButtonText || WORDS.EN.followingButtonText; //Text of the "Following" button.
	confirmationButtonText = confirmationButtonText || WORDS.EN.confirmationButtonText; //Text of the confirmation button.
	unfollowFollowers = typeof(unfollowFollowers) === "undefined" || unfollowFollowers === null ? UNFOLLOW_FOLLOWERS : unfollowFollowers;
	maximumUnfollowActionsTotal = maximumUnfollowActionsTotal === null || !isNaN(parseInt(maximumUnfollowActionsTotal)) ? maximumUnfollowActionsTotal : MAXIMUM_UNFOLLOW_ACTIONS_TOTAL || null;
	maximumUnfollowActionsTotal = !isNaN(parseInt(maximumUnfollowActionsTotal)) ? parseInt(maximumUnfollowActionsTotal) : null;
	maximumUnfollowActionsPerCycle = maximumUnfollowActionsPerCycle === null || !isNaN(parseInt(maximumUnfollowActionsPerCycle)) ? maximumUnfollowActionsPerCycle : MAXIMUM_UNFOLLOW_ACTIONS_PER_CYCLE || null;
	maximumUnfollowActionsPerCycle = !isNaN(parseInt(maximumUnfollowActionsPerCycle)) ? parseInt(maximumUnfollowActionsPerCycle) : null;
	
	//Looks through all the containers of each user:
	var totalLimitReached = false;
	var localLimitReached = false;
	var userContainers = document.querySelectorAll('[data-testid=UserCell]');
	Array.prototype.filter.call
	(
		userContainers,
		function(userContainer)
		{
			//If we have reached a limit previously, exits silently:
			if (totalLimitReached || localLimitReached) { return; }
			//If we have reached the maximum desired number of total unfollow actions, exits:
			else if (maximumUnfollowActionsTotal !== null && _UNFOLLOWED_TOTAL >= maximumUnfollowActionsTotal) { console.log("Exiting! Limit of unfollow actions in total reached: " + maximumUnfollowActionsTotal); totalLimitReached = true; return;  }
			//...otherwise, if we have reached the maximum desired number of local unfollow actions, exits:
			else if (maximumUnfollowActionsPerCycle !== null && unfollowed >= maximumUnfollowActionsPerCycle) { console.log("Exiting! Limit of unfollow actions per cycle reached: " + maximumUnfollowActionsPerCycle); localLimitReached = true; return;  }
			
			//Checks whether the user is following you:
			if (!unfollowFollowers)
			{
				var followsYou = false;
				Array.from(userContainer.querySelectorAll("*")).find
				(
					function(element)
					{
						if (element.textContent === followsYouText) { followsYou = true; }
					}
				);
			}
			else { followsYou = false; } //If we want to also unfollow followers, we consider it is not a follower.

			//If the user is not following you (or we also want to unfollow followers):
			if (!followsYou)
			{
				//Finds the user name and checks whether we want to skip this user or not:
				var skipUser = false;
				var userName = "";
				Array.from(userContainer.querySelectorAll("[href^='/']")).find
				(
					function (element)
					{
						if (skipUser) { return; }
						if (element.href.indexOf("search?q=") !== -1 || element.href.indexOf("/") === -1) { return; }
						userName = element.href.substring(element.href.lastIndexOf("/") + 1).toLowerCase();
						Array.from(element.querySelectorAll("*")).find
						(
							function (subElement)
							{
								if (subElement.textContent.toLowerCase() === "@" + userName)
								{
									if (SKIP_USERS.indexOf(userName) !== -1)
									{
										console.log("We want to skip: " + userName);
										skipUser = true;
									}
								}
							}
						);
					}
				);
				
				//If we do not want to skip the user:
				if (!skipUser)
				{
					//Finds the unfollow button:
					Array.from(userContainer.querySelectorAll('[role=button]')).find
					(
						function(element)
						{
							//If the unfollow button is found, clicks it:
							if (element.textContent === followingButtonText)
							{
								console.log("* Unfollowing: " + userName);
								element.click();
								unfollowed++;
								_UNFOLLOWED_TOTAL++;
							}
						}
					);
				}
			}
		}
	);
	
	//If there is a confirmation dialog, press it automatically:
	Array.from(document.querySelectorAll('[role=button]')).find //Finds the confirmation button.
	(
		function(element)
		{
			//If the confirmation button is found, clicks it:
			if (element.textContent === confirmationButtonText)
			{
				element.click();
			}
		}
	);
	
	return totalLimitReached ? null : unfollowed; //If the total limit has been reached, returns null. Otherwise, returns the number of unfollowed people.
}


//Scrolls and unfollows non-followers, constantly:
var scrollAndUnfollow = function()
{
	window.scrollTo(0, document.body.scrollHeight);
	var unfollowed = performUnfollow(WORDS[LANGUAGE].followsYouText, WORDS[LANGUAGE].followingButtonText, WORDS[LANGUAGE].confirmationButtonText, UNFOLLOW_FOLLOWERS, MAXIMUM_UNFOLLOW_ACTIONS_PER_CYCLE, MAXIMUM_UNFOLLOW_ACTIONS_TOTAL); //For English, you can try to call it without parameters.
	if (unfollowed !== null) { setTimeout(scrollAndUnfollow, MS_PER_CYCLE); }
	else { console.log("Total desired of unfollow actions performed!"); }
};
scrollAndUnfollow();

b. Unfollow all

5. To unfollow all those people you’re following, then copy and paste this code to console and press ‘Enter’

(() => {
  const $followButtons = '[data-testid$="-unfollow"]';
  const $confirmButton = '[data-testid="confirmationSheetConfirm"]';

  const retry = {
    count: 0,
    limit: 3,
  };

  const scrollToTheBottom = () => window.scrollTo(0, document.body.scrollHeight);
  const retryLimitReached = () => retry.count === retry.limit;
  const addNewRetry = () => retry.count++;

  const sleep = ({ seconds }) =>
    new Promise((proceed) => {
      console.log(`WAITING FOR ${seconds} SECONDS...`);
      setTimeout(proceed, seconds * 1000);
    });

  const unfollowAll = async (followButtons) => {
    console.log(`UNFOLLOWING ${followButtons.length} USERS...`);
    await Promise.all(
      followButtons.map(async (followButton) => {
        followButton && followButton.click();
        await sleep({ seconds: 1 });
        const confirmButton = document.querySelector($confirmButton);
        confirmButton && confirmButton.click();
      })
    );
  };

  const nextBatch = async () => {
    scrollToTheBottom();
    await sleep({ seconds: 1 });

    const followButtons = Array.from(document.querySelectorAll($followButtons));
    const followButtonsWereFound = followButtons.length > 0;

    if (followButtonsWereFound) {
      await unfollowAll(followButtons);
      await sleep({ seconds: 2 });
      return nextBatch();
    } else {
      addNewRetry();
    }

    if (retryLimitReached()) {
      console.log(`NO ACCOUNTS FOUND, SO I THINK WE'RE DONE`);
      console.log(`RELOAD PAGE AND RE-RUN SCRIPT IF ANY WERE MISSED`);
    } else {
      await sleep({ seconds: 2 });
      return nextBatch();
    }
  };

  nextBatch();
})();

Tags: Twitter
Previous Post

Essential supplements for women

Next Post

How to disable PHP error logs

Victor Mochere

Victor Mochere

Victor Mochere is an award winning blogger, social media influencer, literati savant, altruistic, and a netpreneur creating and marketing digital content.

Related Posts

How to view a cached version of a website
Life Hacks

How to view a cached version of a website

by Victor Mochere
How to transfer WhatsApp chats to Telegram
Life Hacks

How to transfer WhatsApp chats to Telegram

by Victor Mochere
How to transfer WhatsApp chats to Signal
Life Hacks

How to transfer WhatsApp chats to Signal

by Victor Mochere
How to grow your YouTube channel quickly
Life Hacks

How to grow your YouTube channel quickly

by Victor Mochere
How to make money on YouTube
Life Hacks

How to make money on YouTube

by Victor Mochere
How to install WordPress on cPanel
Life Hacks

How to install WordPress on cPanel

by Victor Mochere
Next Post
How to disable PHP error logs

How to disable PHP error logs

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Comment Policy.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trending posts

  • Top 10 highest earning creators on OnlyFans

    Top 10 highest earning creators on OnlyFans 2021

    2 shares
    Share 0 Tweet 0
  • Top 20 richest singers in the world 2021

    0 shares
    Share 0 Tweet 0
  • Best sites to watch or download movies for free

    4 shares
    Share 4 Tweet 0
  • Top 10 best gay dating apps 2021

    1 shares
    Share 0 Tweet 0
  • Best quotes on respecting women

    1 shares
    Share 0 Tweet 0

Download our app

Google-play
Shopping-bag
Amazon

Newsletter

Subscribe to our newsletter and get the latest posts delivered to your inbox.

*We hate spam as you do.

Editorial policy

Permission to use quotation from any article is granted subject to full credit of the source being given by referencing the direct link of the article on Victor Mochere. However, reproducing any content on this site without explicit permission is strictly prohibited.

Report a correction or typo

We are committed to upholding our editorial standards, including accuracy. Our policy is to review each issue on a case by case basis, immediately upon becoming aware of a potential error or need for clarification, and to resolve it as quickly as possible. If you notice an error or typo that needs correction, please don’t hesitate to contact us for immediate action.

ABOUT US

Victor Mochere brings you a daily dose of well curated up to date facts, news, opinions and important updates from Kenya, Africa and around the World.

FOLLOW US

Facebook-f
Twitter
Instagram
Pinterest
Linkedin
Youtube
Telegram
Rss

FIND US ON

Newspaper
Flipboard

TOPICS

  • Business
  • Education
  • Entertainment
  • Flacked
  • Governance
  • Life Hacks
  • Living
  • Sports
  • Technology
  • Travel
  • Wealth

DOWNLOAD OUR APP

Google-play
Shopping-bag
Amazon

NEWSLETTER

Subscribe to our newsletter and get the latest posts delivered to your inbox.

*We hate spam as you do.

  • Advertise
  • Disclaimer
  • Copyright
  • DMCA
  • Cookies
  • Privacy Policy
  • Write For Us
  • Contact

Copyright © 2021 Victor Mochere. All rights reserved.

No Result
View All Result
  • Topics
    • Wealth
    • Business
    • Education
    • Travel
    • Technology
    • Living
    • Entertainment
    • Governance
    • Sports
    • Life Hacks
  • About
    • Victor Mochere Bio
  • Archives
  • CPA Notes
  • Digital Marketing
  • Social Media Policy
  • Sitemap

Copyright © 2021 Victor Mochere. All rights reserved.

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy Policy and Cookie Policy.