Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: API #11

Open
iGerman00 opened this issue Oct 19, 2024 · 0 comments
Open

feat: API #11

iGerman00 opened this issue Oct 19, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@iGerman00
Copy link
Owner

A robust API for koutube that can be used in applications such as Discord bots (e.g. for faster or prettier embeds) would be a nice addition. It should basically return all the data from an embed but in a machine-readable JSON format instead of the spec-horror HTML. I currently don't have time to work on this. This should be as easy, however, as early returning embedData or its equivalent from each handler, plus all the logic to handle checking for whether or not it's a request to the API rather than the service.

  1. API must work with all content types (playlists, mixes, images, videos and channels)
  2. API must return the content type that has been recognized
  3. API should probably cache but not display in the listing.
  4. API should operate on /api but otherwise handle normally, so GETting /api/dQw4w9WgXcQ should return the data to anyone who asks (not just bots).
  5. The API should support all the same URL params we have
  6. The API must be documented in a separate markdown document outlining all available parameters and quirks as well as response schemas.
  7. API must return the data available in the embed, in no particular order. Depending on availability:
    • Site name (the constant appName)
    • Theme color
    • Player stream URL - just the working one that gets ultimately chosen in the embed
    • Video width and height
    • Image
    • Description
    • Original (redirect) URL to real youtube
    • Author name
    • Upload date text
    • Like count
    • Dislike count
    • Subscriber count
    • Followers count
    • View count
    • Video/song count
    • Image data (if present for the embed image generator)
    • Error text, if present

The presence of each data point depends on which content the embed is for and if it actually exists.

I'd prefer if it was done in a clean way without major refactoring of the current structure. There's a lot of logic to be very mindful of.

@iGerman00 iGerman00 added enhancement New feature or request good first issue Good for newcomers labels Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant