anyaudio / anyaudio-server

:musical_note: Simple server to search youtube and give direct audio download and stream links
91 stars 19 forks source link

Make API more straight forward #132

Open singhpratyush opened 7 years ago

singhpratyush commented 7 years ago

The Problem

As of now, we use complex URLs to refer to videos, which can only be generated on the server. This means that if someone wishes to download a song from our API, she will have to search for it using our API. This means that she will be making some request to our server and our server will be wasting precious time processing it.

Looking at the overview, we are sacrificing our computing resource just to introduce redundancy.

Moreover, we need to specify many parameters to generate the encodes string. In this way, we can't serve requests for whom we only know the video ID (we need more things to encode). This impacts the scale of application (as I had noticed while working on lite-explode part).

New API

The new API I am thinking of will be simple -

In this way, we can simply get AnyAudio for a Youtube video if we just know its ID.

Overview

So this is what will be happening -

This would lower effort of the server but would work only if the clients are smart. That is, they need to perform the search for themselves, get to know about a video/playlist, etc. all by themselves.

Threats

With the current API, it's hard to guess API usage if you are new to this world (but its doable). Whereas in the new case, things will be quite simple. So we may encounter times when someone/something start making lots of requests to our server to get songs.

But if we look carefully, the situation is not avoidable even with the current structure.

@ansarimofid @aviaryan @bxute: What are your views?

aviaryan commented 7 years ago

@singhpratyush In general, this proposal looks good. I haven't reviewed it deeply though. I want to say that we should first concentrate on issues that are smaller/more important/less breaking/more concerned with user. This is because we need to do a public release as soon as possible. So let's do this after the release. We can work on #112 (feature to contact the developers) , #115 (adverts in website) instead in the meanwhile.

michelkaeser commented 6 years ago

+1