Twitter FakeNFT
This project is a server that fetches your Twitter profile picture and applies the hexagonal transparency mask displayed on the profiles of users who have an NFT profile picture.
More info about Twitter NFT pictures here
The profile picture change needs to be done on Twitter Desktop with the picture generated by this server (you'll need to right-click > save as
, isn't it ironic?), otherwise Twitter will trigger some modifications that remove the transparency.
Getting Twitter tokens
You need to provide your API keys to the program so it can work (only used to get a user's profile picture URL)
- Request a Twitter API key on The Twitter developer portal. This only takes a couple minutes, you need to have a verified phone number on your account.
- Generate a user token for the app you just created on the developer dashboard
- You should now have 5 secrets provided by Twitter. Store them in their corresponding strings inside api_secrets.py
Technical details
You will need to install the following packages:
pip install tweepy pillow Flask Flask-Limiter
Twitter's API limits allow us to do 900 profile picture URL requests per 15 minutes (1/second on average). If there are too many requests it can block the service, so there are two things to avoid that:
- A local lru_cache stores the resulting image for a given user so we don't have to fetch the base image again
- There is a rate limit on the server to avoid a single user filling the limit for everyone (currently 5/minute and 20/hour)
Start
./launch.sh
Since the server runs on port 80, it needs sudo rights. If you don't want that, you can just change the port and remove sudo in launch.sh.
This command displays server logs, but exiting with Ctrl-C will not kill the server.
Why?
It's all about having fun! NFTs are a scam and people who use this feature are show-offs.
NFT pictures are not only about the hexagon!!! :(
Yep, but this project is the closest you're ever gonna get to an NFT profile picture without having to spend $100 to mint stolen art on the blockchain and pay $3/month on a Twitter Blue subscription. Also, cry louder