-
On March 24, 2022, Elon Musk tweeted: "Twitter algorithm should be open source"
-
On April 14, 2022, Elon initiated an acquisition of Twitter. The acquisition was completed on October 27, 2022.
-
On April 27, 2022, Cory Etzkorn built a fake Twitter Algorithm: https://github.com/coryetzkorn/twitter-algorithm
-
On March 31, 2023 Twitter released the official Twitter Algorithm. This is a set of rules that governs how Twitter's algorithm determines what content is shown to users in the search and For You tabs.
Today:
- I rebuilt Cory's algorithm to match the official Twitter Algorithm
- I also added ChatGPT to generate the tweet to maximize the algorithm's score
Want to see how your tweet will score? Try the official algorithm for yourself.
If you would like to run this project locally, follow these steps:
-
Clone this repo
git clone https://github.com/mfts/twitter-algorithm-rank.git
-
Install dependencies
npm install
-
Copy
.env.example
to.env
and addOPENAI_API_KEY
as an environment variablecp .env.example .env
-
Run the development server
npm run dev
-
Open http://localhost:3000 with your browser to see the result.
If you would like to contribute, please open an issue or a pull request.
Head over to twitter-algorithm.ts
to see the algorithm.
There are lots of rules from the official Twitter Algorithm yet to be implemented. A good summary of the rules can be found here.
- Cory Etzkorn for building the original algorithm, which heavily inspired this project
- Hassan El Mghari for building Twitterbio, which provided the code for streaming OpenAI results via Vercel Edge Functions.