Giter VIP home page Giter VIP logo

real-time-twitter-banner's Introduction

Real-time Twitter Header

This is a fun little experiment with Twitter API. See my tweet!

CleanShot 2021-05-08 at 20 41 05@2x

How to setup for your Twitter

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

Run the script

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!

How the script works

Read my thread here. Summary:

  1. Fetch your replies using Twitter API. (Rate limit: 180 requests per 15 mins)
  2. Filter the emojis from the text (not easy as it seems).
  3. Slap the emojis into the default banner (emoji images provided by twemoji).
  4. 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.

Most importantly

Follow me on Twitter! https://twitter.com/tdinh_me

Thanks!

License

AGPLv3

real-time-twitter-banner's People

Contributors

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