{"id":19345218,"url":"https://github.com/maxhollmann/ruby-ytdl","last_synced_at":"2025-04-23T04:36:27.196Z","repository":{"id":56899199,"uuid":"261541523","full_name":"maxhollmann/ruby-ytdl","owner":"maxhollmann","description":"A Ruby wrapper for youtube-dl with progress callbacks","archived":false,"fork":false,"pushed_at":"2024-01-22T19:46:39.000Z","size":21,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T08:22:11.642Z","etag":null,"topics":["downloader","ruby","ruby-gem","wrapper","youtube","youtube-dl"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/maxhollmann.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}},"created_at":"2020-05-05T17:38:47.000Z","updated_at":"2024-05-31T16:08:37.000Z","dependencies_parsed_at":"2024-01-22T21:08:46.571Z","dependency_job_id":"1e2ed2db-b59b-4d36-a197-7bad9a7eb4ee","html_url":"https://github.com/maxhollmann/ruby-ytdl","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"f91228b5460f6a4f5436b2288969b7fa60742a70"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxhollmann%2Fruby-ytdl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxhollmann%2Fruby-ytdl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxhollmann%2Fruby-ytdl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxhollmann%2Fruby-ytdl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxhollmann","download_url":"https://codeload.github.com/maxhollmann/ruby-ytdl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250263140,"owners_count":21401804,"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":["downloader","ruby","ruby-gem","wrapper","youtube","youtube-dl"],"created_at":"2024-11-10T04:05:36.063Z","updated_at":"2025-04-23T04:36:26.905Z","avatar_url":"https://github.com/maxhollmann.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ytdl\n\nA Ruby wrapper for yt-dlp/youtube-dl with progress callbacks.\n\n## Installation\n\n```shell\ngem install ytdl\n```\n\n```ruby\ngem 'ytdl'\n```\n\nMake sure you have [yt-dlp](https://github.com/yt-dlp/yt-dlp) or [youtube-dl](https://github.com/ytdl-org/youtube-dl) installed and available in your `PATH`. If you have `pip` installed:\n\n```shell\npip install yt-dlp\n# or\npip install youtube-dl\n```\n\n## Usage\n\nMinimal example:\n\n```ruby\nYoutubeDL.download('https://www.youtube.com/watch?v=MmIWve5bUpU').call\n```\n\nWith callbacks and options:\n\n```ruby\nstate = YoutubeDL.download('https://www.youtube.com/watch?v=MmIWve5bUpU', format: 'mp4')\n  .on_progress do |state:, line:|\n    puts \"Progress: #{state.progress}%\"\n  end\n  .on_error do |state:, line:|\n    puts \"Error: #{state.error}\"\n  end\n  .on_complete do |state:, line:|\n    puts \"Complete: #{state.destination}\"\n  end\n  .call\n```\n\n`YoutubeDL.download` returns the state after `yt-dlp` has exited. If the download was successful, `state.info_json` is loaded into `state.info` and the `info_json` file deleted.\n\n### Configuration\n\n```ruby\nYoutubeDL::Command.config.executable = 'youtube-dl' # if you're using youtube-dl instead of yt-dlp\nYoutubeDL::Command.config.default_options = { some_option: true }\n```\n\n### Events\n\nOne event is emitted for each line printed by `yt-dlp`.\n\nThe full list of events types is:\n\n* `unparsable`: The `OutputParser` couldn't parse the line\n* `destination`: Download destination announcement (stored in `state.destination`)\n* `info_json`: Info JSON destination announcement (stored in `state.info_json`)\n* `progress`: Download progress in percentage (stored in `state.progress`)\n* `error`: An error message (stored in `state.error` without the `ERROR: ` prefix)\n* `complete`: The download is complete (Info JSON is parsed into `state.info` and deleted, `state.destination` now exists)\n* `unclear_exit_state`: `yt-dlp` exited without error, but either `destination` or `info_json` does not exist\n\n### Options\n\nOptions passed to `YoutubeDL.download` get transformed as follows:\n\n* `some_option: true` becomes `--some-option`\n* `some_option: false` becomes `--no-some-option`\n* `some_option: 'anything'` becomes `--some-option anything`\n* `some_option: nil` can be used to remove a default option\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxhollmann%2Fruby-ytdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxhollmann%2Fruby-ytdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxhollmann%2Fruby-ytdl/lists"}