Code Monkey home page Code Monkey logo

tweetpic's Introduction

TweetPic

TweetPic allows you to capture and serve images of a tweet.

Notes

  • this was run in Linux/Debian 12-64
  • filled .env
  • with https

Require

  • go 1.19++
  • chrome
  1. run manually chrome/ium headless devtools debugging remote with
    • "chromium --headless=old --disable-gpu --remote-debugging-port=9222"
  2. bash build_run.sh (?sudo)

Endpoints

1. Get Tweet Picture

Retrieves a picture of a specified tweet.

  • URL: /tweetpic
  • Method: GET
  • Query Parameters:
    • id (required): The ID of the tweet to capture

Responses

  • 200 OK

    • Content-Type: application/json
    • Schema:
      {
        "TweetPicUrl": "/image?name=123e4567-e89b-12d3-a456-426614174000.jpeg"
      }
  • 400 Bad Request

    • Content-Type: application/json
    • Schema:
      {
        "Error": "Tweet Doesnt Exist"
      }
  • 429 Too Many Requests

    • Content-Type: application/json
    • Schema:
      {
        "Error": "Too many requests, slow down!"
      }

2. Serve Image

Serves the generated tweet image.

  • URL: /image
  • Method: GET
  • Query Parameters:
    • name (required): The name of the image file to serve

Responses

  • 200 OK

    • Content-Type: image/jpeg, image/png, or image/gif
    • Content: Binary image data
  • 400 Bad Request

    • Content-Type: text/plain
    • Content: Error message
  • 404 Not Found

    • Content-Type: text/plain
    • Content: Error message

3. Health Check

Checks the health status of the API.

  • URL: /health-check
  • Method: GET

Responses

  • 200 OK
    • Content-Type: application/json
    • Schema:
      {
        "Status": 200
      }

Additional Notes

  • The API serves static files from the root directory.
  • Tweet screenshot image files are stored in the ./images/ directory.
  • The server listens on port 443 for HTTPS connections.

tweetpic's People

Contributors

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