This is a fun little experiment with Twitter API. See my tweet!
Just fill in your information in the emojiheader.js
script.
const TWITTER_HANDLE = '@tdinh_me';
const credentials = {
consumer_key: 'YOUR KEY HERE',
consumer_secret: 'YOUR KEY HERE',
access_token_key: 'YOUR KEY HERE',
access_token_secret: 'YOUR KEY HERE'
};
To get the API keys, you need to apply for a Twitter Developer account. It's free and take ~5 minutes.
Lastly, change the default banner 1500x500.png
or use the default one here. Make sure it's a png
(as in the mimetype, not just the file extension).
PS: would be nice if you could leave the credit :P
Install dependencies:
yarn
or
npm install
Note: if you are using an M1 MacBook, the image processing dependency may fail to install. Use another laptop or run it on a server.
Start the app:
node emojiheader.js
Keep it running and have fun!
Read my thread here. Summary:
- Fetch your replies using Twitter API. (Rate limit: 180 requests per 15 mins)
- Filter the emojis from the text (not easy as it seems).
- Slap the emojis into the default banner (emoji images provided by twemoji).
- Update your profile banner using Twitter API. (Rate limit: 30 requests per 15 mins)
The script fetch new replies every 6 seconds (to avoid rate limit), then update the banner only if there are new emojis.
The delay between reply and banner update is between 6s to 15s.
Follow me on Twitter! https://twitter.com/tdinh_me
Thanks!
AGPLv3