{"id":18805575,"url":"https://github.com/melchor629/youtubedl-audio-api","last_synced_at":"2025-08-03T16:37:29.987Z","repository":{"id":81784916,"uuid":"126620305","full_name":"melchor629/youtubedl-audio-api","owner":"melchor629","description":"An RESTful API for YoutubeDL that only returns audio URLs","archived":false,"fork":false,"pushed_at":"2025-03-06T09:03:55.000Z","size":419,"stargazers_count":19,"open_issues_count":0,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-27T09:51:49.940Z","etag":null,"topics":["dockerfile","flask","python","python3","restful-api","youtube-dl"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/melchor629.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-24T16:51:52.000Z","updated_at":"2025-03-06T09:03:56.000Z","dependencies_parsed_at":"2023-09-26T01:39:40.964Z","dependency_job_id":"1462d996-5719-4b54-b769-11ef8f3d4f4c","html_url":"https://github.com/melchor629/youtubedl-audio-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fyoutubedl-audio-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fyoutubedl-audio-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fyoutubedl-audio-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melchor629%2Fyoutubedl-audio-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melchor629","download_url":"https://codeload.github.com/melchor629/youtubedl-audio-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766740,"owners_count":21158301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dockerfile","flask","python","python3","restful-api","youtube-dl"],"created_at":"2024-11-07T22:44:25.040Z","updated_at":"2025-04-13T19:12:00.056Z","avatar_url":"https://github.com/melchor629.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTube-DL Audio API\n\nAn pythonic RESTful API for getting URL of YouTube videos with only audio or video+audio, perfect for playing in background reducing the network bandwith. Uses [yt-dlp][1] for the queries, and [Flask][2] for the web microframework.\n\n## Requirements\n\nThe project requires Python 3.10 or higher, and install some dependencies.\n\n```bash\npipenv install\n```\n\nFor local development, `pipenv` will create a virtual environment for you. There's a [Dockerfile][3] available for creating an image.\n\nYou can use the Docker image to use it in development. (see Docker section) This command should do the trick:\n\n```bash\ndocker container run --rm -it -p 5000:5000 melchor9000/youtubedl-audio-api\n```\n\n## Using the web\n\nBy default, running the app with `flask --app ytdl_audio_api.app run --debug` will run on http://localhost:5000 . If you set the environment variable `PORT` to some port, it will listen for everyone at the specified port.\n\nThe app can be scalated using `gunicorn -c gunicorn_config.py ytdl_audio_api.wsgi`. Is configured to use `gevent` for asynchronous serving.\n\nYou can deploy the app to [Heroku][4] or into a [Docker][3] environment.\n\n\u003e **Note**: by default it will use `2 * Cores + 1` workers. You can change this using the `WORKERS`\n\u003e environment variable. In Heroku this is mandatory, so add a \"Config Var\" called `WORKERS` and put\n\u003e a value of 1 or 2 (if using the free dyno).\n\n## RESTful API\n\nThe API is described in the [OpenApi Schema][oas] or in the `/oas.yaml`/`/swagger.yaml` of a deployed service. Use \u003chttps://editor.swagger.io\u003e, \u003chttps://petstore.swagger.io\u003e (filling the URL at the top) or any other Swagger UI instance to see the API and its documentation.\n\nWith the spec, you can also generate clients to talk to your own instance on to my public instance.\n\n## Docker\n\nBy default, the Docker image created will publish the web in the port 5000. Uses the `python:3` image.\n\nAn example of building the image, running and testing:\n\n```bash\ndocker image build -t yt-audio-api .\ndocker container run -d --rm -p 5000:5000 yt-audio-api # or melchor9000/youtubedl-audio-api from Docker Hub\ncurl http://localhost:5000/api/0RLvtm0EghQ\n```\n\nIt is available a `docker-compose.yaml` file to test it out. Uses the image from Docker Hub and a redis server for caching.\n\n## Cache\nSome request can be cached using Redis. The only thing you must do to use Redis is setting the environment\nvariable `REDIS` (or `REDIS_URL` useful for Heroku) with the url of the server.\n\n## Logging\nThe server has logging for some points of functions. To modify the logging level, set `LOGGING_LEVEL` environment variable to the value you want. Valid values are `CRITICAL`, `FATAL`, `ERROR`, `WARNING`, `WARN`, `INFO`, `DEBUG` or `NOTSET`, see [logging][5] from Python.\n\n## Proxy\n\nYou can set a proxy with the environment variable `PROXY`. Supported proxy protocols are http, https and socks5.\n\nIf you want to use a proxy as a fallback, use `FALLBACK_PROXY`. This will be used if any call to the YT API fails.\n\n## CORS\n\nBy default, CORS is set to allow all origins. This can be overriden by defining the environment variable `CORS_ORIGINS` with a comma-separatid list of origins.\n\n## Pretty JSONs\n\nIf, for some reason, you want to get the JSONs in a pretty format, set `JSONIFY_PRETTYPRINT_REGULAR` environment variable to `true`.\n\n  [1]: https://github.com/yt-dlp/yt-dlp\n  [2]: http://flask.pocoo.org\n  [3]: https://docker.com\n  [4]: https://heroku.com\n  [5]: https://docs.python.org/3/library/logging.html#logging-levels\n  [oas]: https://github.com/melchor629/youtubedl-audio-api/blob/master/ytdl_audio_api/oas.yaml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelchor629%2Fyoutubedl-audio-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelchor629%2Fyoutubedl-audio-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelchor629%2Fyoutubedl-audio-api/lists"}