Code Monkey home page Code Monkey logo

infinity-snap's Introduction

Infinity-Snap

Perfect Balance on twitter

python3 main.py

In real World we dont have infinity stones. There is no snap to remove half of the living, but We have something better: Virtual World! We can create what ever we want, and we can destroy what ever we want. This situation makes us a Thanos like titans who holds the infinity gauntlet.

This being said, I though it would be fun to delete randomly fifty percent of my posts in social media. It was one of my stupidest idea but who cares and I thought it would be even more idiotic to actually share the code I used. So let me walk you through.

First we need to get Twitter API access. Get an account to from https://developer.twitter.com/ and create a new app. After that point you should have 4 code. API key, API secret key, Access token and Access token secret. If you have them rest is easy!

# Get the environment ready
import tweepy
auth = tweepy.OAuthHandler(API_key, API_secret_key)
auth.set_access_token(Access_token, Access_token_secret)
api = tweepy.API(auth)

Now, just get the tweets and tweet ids.

tweet_ids = []
tweets = {}
for status in tweepy.Cursor(api.user_timeline).items():
    tweet_ids.append(status.id)
    tweets[status.id] = [status.text, status.favorite_count]

Now we need a balance :Smile:

# Randomly change the places
random.shuffle(tweet_ids)
removed_tweets = []
# Get and delete first half :D 
for i in range(len(tweet_ids)//2):
    removed_tweets.append(tweets[tweet_ids[i]])
    api.destroy_status(tweet_ids[i])

Or if you don't wanna do all that I have a repository that you can use:

Repository Link

It runs with flask and displays deleted tweets.

This is all I wanna share for now. See you until I have another โ€œgoodโ€ idea ๐Ÿ˜‚

infinity-snap's People

Contributors

ahmethamzaemra avatar

Stargazers

 avatar  avatar  avatar  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.