Giter Site home page Giter Site logo

anyaudio / anyaudio-server Goto Github PK

View Code? Open in Web Editor NEW
91.0 91.0 19.0 1.13 MB

:musical_note: Simple server to search youtube and give direct audio download and stream links

Shell 2.72% Python 38.21% HTML 32.52% JavaScript 12.18% CSS 13.54% Makefile 0.19% Dockerfile 0.63%
flask music postgresql python rest-api youtube youtube-dl

anyaudio-server's People

Contributors

ansarimofid avatar aviaryan avatar singhpratyush avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anyaudio-server's Issues

Complete slide on little scroll

The orange view on /beta page should slide down completely even on a little scrolling, as is the case while clicking Explore button.

Search not working

Upon inspection, I found out that setting INF in search.get_videos was the issue.

        pos = html.find('yt-lockup-tile')
        if pos == -1:
            pos = INF
        vid.append(html[:pos + 2])

So string operation html[:pos+2] didn't work (as INF is not an integer).

Add AUTHORS

A simple text file to keep track of all those who contributed to the code.

Encrypt get download link (/g/) API

API to get download url of a video ( /g/ ) can be encrypted to prevent public use. On /search, encrypted download links can be returned in the response. So the android and web app will have no problems whatsover. On the other hand, we will be able to reduce ill-use of our API and server.
And this will automatically fix #17 .

I see only up-sides of this change. So I think I will do it.

@bxute Android app will need update after this.

Official "numb" song won't download

The first result when searching "numb" with title Numb (Official Video) - Linkin Park and ID kXYiU_JCYtU doesn't download when clicking on the link. It opens up a blank page.

Research/Fix this issue, then close.

Make the website public

Make the website along with the API public.
If there are issues later, we can make it back to private.

@bxute What do you think ?

Related #2

Implement a log viewer on the website

Let's make the url /logs show the most recent request logs. To prevent unauthorized access, we can protect it using environment variable SECRET_KEY which is being already used in encryption.

Proper error handling and reporting

Currently any server error returns an 500 with message Some error occurred. Proper error handling and reporting needs to take place. Different child classes of Exception can be kept in core/utils.py which will be used to track different problems as they occur.

def something():
    ...
    try:
        try:
            do_complex_operation_1()
        except MyException1:
            raise MyException2()
        ...
        try:
            do_complex_operation_2()
        except MyException3:
            raise MyException4()
        ...
    except MyException2:
        user_message = 'Error in operation 1'
        ...
    except MyException4:
        user_message = 'Error in operation 2'
        ...
    ...
    return_dictionary{'userMessage'} = user_message

This can be used at different levels to precisely track the error.

Convert /api/v1/d/<url> to /api/v1/d?url=...

Currently, the calls are made in the format /api/v1/d/sfsagaehbadfwdVAEDGFVAdFA..., which is too lengthy to log as base path and also doesn't follows API standards.

Better way can be /api/v1/d?url=sfsagaehbadfwdVAEDGFVAdFA....

@aviaryan : Any comments?

Standardize API

Currently, the API calls are like /g/<video id> and /search?q=<query>.

Make it more standard like

  • /api/v1/g/<video id> (or /api/v1/g/<video id>.json, /api/v1/g/<video id>.xml, etc. )
  • /api/v1/search?q=<query> (possibly with more parameters like offset and limit)

The response needs to be standardized too.

Have a look at White House API Standards.

Limit by duration as conversion takes time

The amount of time taken to convert OR the amount of time taken to start download is directly proportional to length. This can keep a worker busy for far more longer time than expected.

Redesign website

Redesign website with a modern and rich interface.
The new design will be kept in beta for a few days under ymp3.aavi.me/beta/.
Be sure to handle the application edge cases correctly in JavaScript. (see main.js)

@ansarimofid

Searching "numb" gives an invalid result

Search "numb"

One of the results is Mix - Numb (Official Video) - Linkin Park with ID as
kXYiU_JCYtU&amp;list=RDkXYiU_JCYtU. Either fix the parser for these types of videos or remove them from the results.

Write tests

  • Number of results when searching "Numb" . Is 19 now.
  • Download of an audio
  • 400 in case of bad download link of audio

Offset in trending API

In /api/v1/trending, no offset parameter is given. Which will be expensive when some AJAX requests for more results.

Dockerize the application

A docker-able application will be easy to setup and run on different platforms. And not to mention, all the cool kids are doing it. So why stand back ? ๐Ÿ˜‰

Run ffmpeg in quiet mode

Running ffmpeg in quite mode will make it faster and save extra output whie running.

ffmpeg -loglevel quiet [...]

Encrypt /d/ download urls

#17 (comment)

The real need is to block users to send any link they want into the /d/ endpoint. And we can do it using little encryption. So I think this issue can be closed. I will open a new issue for encrypting /download urls.

We can use a simple PRIVATE_KEY on the server to encrypt the urls and then further decrypt them back.

Add a Makefile

While writing tests, I realized that running tests locally will require a series of steps.
So we should define a Makefile to streamline the process.
It can also have targets for run and install.

Exception occurs mentioning incorrect padding for many requests.

Error like this are very frequent. They must be removed as soon as possible.

Traceback (most recent call last):
  File "xxxxxx/youtube-mp3-server/ymp3/views.py", line 93, in get_link
    data = decode_data(get_key(), url)
  File "xxxxxx/youtube-mp3-server/ymp3/helpers/encryption.py", line 40, in decode_data
    dec = decode(key, data)
  File "xxxxxx/youtube-mp3-server/ymp3/helpers/encryption.py", line 16, in decode
    enc = base64.b64decode(enc)
  File "/usr/lib/python2.7/base64.py", line 78, in b64decode
    raise TypeError(msg)
TypeError: Incorrect padding

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.