GithubHelp home page GithubHelp logo

linnil1 / cirycle_2022_birthday Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 29.1 MB

Happy birthday to Cirycle

Home Page: https://cirycle-2022-birthday.linnil1.me/

License: MIT License

CSS 1.27% Vue 39.54% Python 53.38% TypeScript 5.80%

cirycle_2022_birthday's Introduction

Cirycle 2022 birthday web

We collect all the tweets with tag "Cirycle生日快樂2022"

And assemble into a big star !

Tools

  • web: Nuxt3 (Using Vue composition API)
  • collect, assemble the star and data server: python3

Setup

For development:

# install packages
yarn install
# start a developing web server
yarn dev
# start a example data serving server
python3 serve_json_data.py

Data Preparation

Register twitter developer(https://developer.twitter.com/en/portal/dashboard), and get the token then save in twitter_secret.py (You can copy from template twitter_secret.example.py)

After all prepared, just run

python3 tweets_to_starts.py

This script will

  • Retrieve tweets and save into database (tweets.json)
  • Download image or Generate image if it's text-only tweet
  • Assign color and position of each image
  • Save the result into json (tweets_cirycle.json)
  • Upload image and json to KV

Web architecture

  • I deploy on Clouflare Worker, all the data are served in KV
  • server/api/tweets.ts is the server script to output tweets json from KV
  • server/api/image.ts is the server script to output binary image data from KV
  • pages/index.vue The main page
  • components/tweet.vue This define how to show each of tweet image
  • components/star.vue It arranage all the tweet image on the canvas
  • components/lighthouse.vue Popup the tweet when click on it

Some basic wrangler (Cloudflare worker) operator

# Create a namespace
wrangler kv:namespace create cirycle_2022_birthday
# upload image
wrangler kv:key put --namespace-id=b90dbe1acf46420f908611387f0bcd08 xx.png --path ./xx.png
# upload json
wrangler kv:key put --namespace-id=b90dbe1acf46420f908611387f0bcd08 tweets_cirycle.json --path ./tweets_cirycle.json
# publish the web
wrangler publish

Notes

When I use Cloudflare as image server, I found this bug https://github.com/nuxt/framework/issues/3982

LICENSE

MIT

BUT the media in assets/* and public/* have copyright. Don't use it for any other usage.

cirycle_2022_birthday's People

Contributors

linnil1 avatar

Watchers

 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.