Coder Social home page Coder Social logo

block_spam's Introduction

block_spam: Follow-Spam Blocker

Python scripts that go through your followers and when a follower is following over a specified threshold (ie following 1,500 accounts), the script blocks their profile. Currently works for Medium.com and Instagram.

I'm sure for some people this doesn't really matter. Personally, I don't post a whole lot, so I'm only really interested in having friends + real people as followers. I find it mildly annoying when I get a bunch notifications about these bot accounts following me. So, I created a script to automatically weed out these accounts.

⚠️ Code provided as is, this is just a small side project that I don't intend spending a whole lot of time on. Especially when the point of the project is to save time. This code makes requests to the Medium.com and Instagram.com servers, authentication is done by reusing cookies from web brower requests. If anyone really wants to use this code, you'll need to copy-paste the cookies from the browser into environment variables (I'm not about to push my cookies to a public repo) with names that are the same as the ones used in the code. A graphql request will also need to be simulated for Instagram.

With cookie/header/graphql data loaded into environmental variables. The code would be run with:

python3 blockBots.py

Required environmental variables

Instagram

export BLOCK_USER_INSTA_COOKIES=''
export BLOCK_USER_INSTA_CSRF=""
export BLOCK_USER_INSTA_AJAX=""
export BLOCK_USER_INSTA_WHITELIST="USERNAME1,USERNAME2,USERNAME3"
export BLOCK_USER_INSTA_QUERY_HASH=""
export BLOCK_USER_INSTA_QUERY_ID=""

"WHITELIST" is not a header, that variable is a list of follower usernames that follow a lot of people, but you don't want to block. QUERY_HASH, and QUERY_ID are not headers either, those are for the GraphQL request, to find those you'll need to block a user in the browser, then look for that GraphQL request.

Medium

export BLOCK_USER_MEDIUM_USERNAME=""
export BLOCK_USER_MEDIUM_COOKIES="
export BLOCK_USER_MEDIUM_USER_ID=""

Screenshots

Medium user blocking

Instagram user blocking


Roadmap

  • ✅ Medium
  • ✅ Instagram
  • 🚧 Twitter

block_spam's People

Contributors

christopher-hayes avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.