{"id":13581512,"url":"https://github.com/wader/ydls","last_synced_at":"2025-04-04T11:16:25.455Z","repository":{"id":38819495,"uuid":"64222005","full_name":"wader/ydls","owner":"wader","description":"youtube-dl HTTP download and transcode service","archived":false,"fork":false,"pushed_at":"2025-04-01T16:03:03.000Z","size":860,"stargazers_count":190,"open_issues_count":5,"forks_count":24,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T16:15:26.500Z","etag":null,"topics":["docker-image","ffmpeg","go","golang","http-server","id3v2","podcast","rss","transcoder","youtube-dl"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/mwader/ydls/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wader.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2016-07-26T13:07:42.000Z","updated_at":"2025-03-29T16:26:45.000Z","dependencies_parsed_at":"2023-11-13T09:45:04.463Z","dependency_job_id":"13446168-70fb-4267-9118-cf987ad9b2ec","html_url":"https://github.com/wader/ydls","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/wader%2Fydls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fydls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fydls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wader%2Fydls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wader","download_url":"https://codeload.github.com/wader/ydls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166169,"owners_count":20894654,"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":["docker-image","ffmpeg","go","golang","http-server","id3v2","podcast","rss","transcoder","youtube-dl"],"created_at":"2024-08-01T15:02:04.067Z","updated_at":"2025-04-04T11:16:25.435Z","avatar_url":"https://github.com/wader.png","language":"Go","funding_links":[],"categories":["Go","HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"## youtube-dl HTTP service\n\nHTTP service for [yt-dlp](https://github.com/yt-dlp/yt-dlp) that downloads media from\nrequested URL and streams, transmux and transcode to requested format if needed.\n\nIt can be used to convert media, create podcasts and audio only versions of media\nfrom various site like youtube, vimeo etc.\n\nDocker image uses [ffmpeg from wader/static-ffmpeg](https://github.com/wader/static-ffmpeg) which\ncan handle most format and codecs. Default configuration can transcode to these format, container and codecs:\n\n|Format|Container|Audio|Video|Subtitle|\n|-|-|-|-|-|\n|alac|mp4|alac|||\n|flac|flac|flac|||\n|gif|gif||gif||\n|m4a|mp4|aac|||\n|mp3|mp3|mp3|||\n|ogg|ogg|vorbis, opus|||\n|wav|wav|pcm_s16le|||\n|mkv|matroska|aac, alac, ac3, mp3, vorbis, opus, flac|h264, hevc, vp8, vp9, theora, av1|subrip, ass|\n|mp4|mp4|aac, alac, mp3, vorbis, flac|h264, vp9, av1, hevc|mov_text|\n|mxf|mxf|pcm_s16le|mpeg2video||\n|ts|mpegts|aac, mp3, ac3|h264, hevc||\n|webm|webm|vorbis, opus|vp8, av1, vp9|webvtt|\n|rss|mp3|mp3|||\n\n\nThe `rss` format transforms a playlist into a RSS audio podcast.\n\nSee [ydls.json](ydls.json) for more details.\n\n## Usage\n\n### Run with docker\n\nPull `mwader/ydls` or build image using the Dockerfile. Run a container and publish\nTCP port 8080 somehow.\n\n`docker run -p 8080:8080 mwader/ydls `\n\n### Build and install yourself\n\nRun `go get github.com/wader/ydls/cmd/ydls` to install `ydls`.\nMake sure you have ffmpeg, yt-dlp, rtmpdump and mplayer\ninstalled and in `PATH`.\n\nCopy and edit [ydls.json](ydls.json) to match your ffmpeg builds\nsupported formats and codecs.\n\nStart with `ydls -server -config /path/to/ydls.json` and it default will listen\non port 8080.\n\n## Endpoints\n\nDownload and make sure media is in specified format:  \n`GET /\u003cformat\u003e[+option+option...]/\u003cURL-not-encoded\u003e`  \n`GET /?format=\u003cformat\u003e\u0026url=\u003cURL\u003e[\u0026codec=...\u0026codec=...\u0026retranscode=...]`\n\nDownload in best format:  \n`GET /\u003cURL-not-encoded\u003e`  \n`GET /?url=\u003cURL-encoded\u003e`  \n\n### Parameters\n\n`format` - Format name. See table above and [ydls.json](ydls.json)  \n`URL` - Any URL that [yt-dlp](https://github.com/blackjack4494/yt-dlc) can handle  \n`URL-not-encoded` - Non-URL-encoded URL. The idea is to be able to simply\nprepend the download URL with the ydls URL by hand without doing any encoding\n(for example in the browser location bar)  \n`codec` - Codec to use instead of default for format (can be specified one or two times for\naudio and video codec)  \n`retranscode` - Retranscode even if input codec is same as output  \n`time` - Only download specificed time range. Ex: `30s`, `20m30s`, `1h20m30s` will limit\nduration. `10s-30s` will seek 10 seconds and stop at 30 seconds (20 second output duration)  \n`items` - If playlist only include this many items\n\n`option` - Codec name, time range, `retranscode` or `\u003cN\u003eitems`\n\n### Examples\n\nDownload and make sure media is in mp3 format:  \n`http://ydls/mp3/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nDownload using query parameters and make sure media is in mp3 format:  \n`http://ydls/?format=mp3\u0026url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcF1zJYkBW4A`\n\nDownload and make sure media is in webm format:  \n`http://ydls/webm/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nDownload and make sure media is in mkv format using mp3 and h264 codecs:  \n`http://ydls/mkv+mp3+h264/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nDownload and retranscode to mp3 even if input is already mp3:  \n`http://ydls/mp3+retranscode/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nDownload specified time range in mp3:  \n`http://ydls/mp3+10s-30s/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nDownload in best format:  \n`http://ydls/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nPlaylist as audio podcast with 3 latest items:  \n`http://ydls/rss+3items/https://www.youtube.com/watch?list=PLtLJO5JKE5YCYgIdpJPxNzWxpMuUWgbVi`\n\n## Tricks and known issues\n\nFor some formats the transcoded file might have zero length or duration as transcoding is done\nwhile streaming. This is usually not a problem for most players.\n\nDownload with curl and save to filename provided by response header:\n\n`curl -OJ http://ydls-host/mp3/https://www.youtube.com/watch?v=cF1zJYkBW4A`\n\nDocker image can download from command line. This will download in mp3 format\nto current directory:\n\n`docker run --rm -v \"$PWD:$PWD\" -w \"$PWD\" mwader/ydls https://www.youtube.com/watch?v=cF1zJYkBW4A mp3`\n\nyt-dlp URL can point to a plain media file.\n\nIf you run the service using some cloud services you might run into geo-restriction\nissues with some sites like youtube.\n\n## Development\n\nWhen fiddling with ffmpeg and yt-dlp related code I usually do this:\n\n```sh\ndocker build --target dev -t ydls-dev . \u0026\u0026 docker run --rm -ti -v \"$PWD:/$PWD\" -w \"$PWD\" ydls-dev\n```\n\nThen inside dev container:\n\n```sh\n# run cli version\ngo run cmd/ydls/main.go -config ./ydls.json -debug\n# run all tests\nCONFIG=\"$PWD/ydls.json\" TEST_EXTERNAL=1 go test -v -cover -race ./...\n```\n\n## TODO\n\n- Optional stream for format? example mp4 at least video or audio?\n- Download playlist as zip archive.\n- JSON output?\n- Refactor messy downloadFormat function. Maybe a media interface with audio, video and subtitle\nimplementations that select best format and return reader and mappings? should share a common\nformat picker so formats can be shared and not re-downloaded.\n- Make download part into an interface to support more than yt-dlp.\n- Bitrate factor per codec when sorting formats (prefer aac over mp3 at same bitrate etc)\n- X-Remote IP header?\n\n## License\n\nydls is licensed under the MIT license. See [LICENSE](LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Fydls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwader%2Fydls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwader%2Fydls/lists"}