anyaudio / anyaudio-server Goto Github PK
View Code? Open in Web Editor NEW:musical_note: Simple server to search youtube and give direct audio download and stream links
:musical_note: Simple server to search youtube and give direct audio download and stream links
The orange view on /beta
page should slide down completely even on a little scrolling, as is the case while clicking Explore
button.
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).
After a way to get video info from its ID has been implemented and used in /download endpoint, we should also give the file a proper name so that it downloads into user's system with a filename more helpful than music.mp3
.
A simple text file to keep track of all those who contributed to the code.
As of now, the song length that shows on browser is 00:00:10
, but vlc
can tell its actual length.
It should return the following values.
When using HTML5 audio element for audio playback, the shown length is always 10 seconds. This doesn't affect the playback though and the audio always plays completely.
This will allow users to test full features of app locally.
It will also help us make sure that playlist links are correct.
Maybe Gitter.
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.
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.
anyaudio/anyaudio-android-app#3
I researched on this issue and found that setting --no-cache-dir option is the reason that some links created are 404. Removing it will fix it.
A try block over the return
response should fix it.
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.
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.
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?
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.
Right now we are using youtube-dl command-line call to get the download url. A more flexible option is to use the Python wrapper. This will allow to get other additional information about the download which is otherwise un-accessible from a single command-line call.
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.
Since now postgres database has been added in the application, the Docker deployment is now non-functional.
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)
Search "numb"
One of the results is Mix - Numb (Official Video) - Linkin Park
with ID as
kXYiU_JCYtU&list=RDkXYiU_JCYtU
. Either fix the parser for these types of videos or remove them from the results.
Download the audio file and convert it to mp3 on the server itself.
Please add about us text in overlay menu section.
Since we have moved on from m4a
to mp3
, serving large songs won't be an issue.
IMO, we can set the limit for m4a
songs to 1 hour and leave the mp3
limit as it is.
In /api/v1/trending
, no offset
parameter is given. Which will be expensive when some AJAX
requests for more results.
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 ? ๐
Running ffmpeg
in quite mode will make it faster and save extra output whie running.
ffmpeg -loglevel quiet [...]
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.
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
.
The current beta website does nothing in case of error.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.