{"id":13895077,"url":"https://github.com/knadh/go-get-youtube","last_synced_at":"2025-03-23T23:30:45.408Z","repository":{"id":57492080,"uuid":"17250896","full_name":"knadh/go-get-youtube","owner":"knadh","description":"A tiny Go library + client for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos.","archived":false,"fork":false,"pushed_at":"2019-11-05T14:44:39.000Z","size":39,"stargazers_count":163,"open_issues_count":5,"forks_count":37,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-19T00:23:48.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","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/knadh.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}},"created_at":"2014-02-27T14:11:26.000Z","updated_at":"2025-01-02T09:37:03.000Z","dependencies_parsed_at":"2022-08-28T11:50:33.183Z","dependency_job_id":null,"html_url":"https://github.com/knadh/go-get-youtube","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fgo-get-youtube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fgo-get-youtube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fgo-get-youtube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knadh%2Fgo-get-youtube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knadh","download_url":"https://codeload.github.com/knadh/go-get-youtube/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186437,"owners_count":20574551,"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":[],"created_at":"2024-08-06T18:01:58.554Z","updated_at":"2025-03-23T23:30:45.070Z","avatar_url":"https://github.com/knadh.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-get-youtube v 0.2\nA tiny Go library + client (command line Youtube video downloader) for downloading Youtube videos. The library is capable of fetching Youtube video metadata, in addition to downloading videos. If ffmpeg is available, client can extract MP3 audio from downloaded video files.\n\nKailash Nadh, http://nadh.in --\n27 February 2014\n\nLicense: GPL v2\n\n# Client\nOnce you have compiled or [downloaded](https://github.com/knadh/go-get-youtube/releases) the binary, simply run the following on your terminal:\n\n`ytdownload -id=youtube_video_id`\n\n## Building\n```\n$ export GOPATH=$PWD/go-get-youtube\n$ go get github.com/knadh/go-get-youtube\n$ cd go-get-youtube/bin\n$ ./go-get-youtube -id=cN_DpYBzKso -itag 18 -rename -mp3\n\nExtracted audio: cN_DpYBzKso-rob-pike-concurrency-is-not-parallelis.mp3\nDownload duration: 5s\nAverage speed: 16.1MB/s\nDownloaded video: cN_DpYBzKso-rob-pike-concurrency-is-not-parallelism.mp4\n```\n# Library\n\n## Methods\n\n### youtube.Get(youtube_video_id)\n`video, err = youtube.Get(youtube_video_id)`\n\nInitializes a `Video` object by fetching its metdata from Youtube. `Video` is a struct with the following structure\n\n```go\n{\n\tId, Title, Author, Keywords, Thumbnail_url string\n\tAvg_rating float32\n\tView_count,\tLength_seconds int\n\tFormats []Format\n}\n```\n\n`Video.Formats` is an array of the `Format` struct, which looks like this:\n\n```\ntype Format struct {\n\tItag int\n\tVideo_type, Quality, Url string\n}\n\ntype Option struct {\n\tResume bool // resume failed or cancelled download\n\tRename bool // rename output file using video title\n\tMp3    bool // extract audio using ffmpeg\n}\n```\n\n### youtube.Download(format_index, output_file, option)\n`format_index` is the index of the format listed in the `Video.Formats` array. Youtube offers a number of video formats (mp4, webm, 3gp etc.)\n\n### youtube.GetExtension(format_index)\nGuesses the file extension (avi, 3gp, mp4, webm) based on the format chosen\n\n## Example\n```go\nimport (\n\tyoutube \"github.com/knadh/go-get-youtube/youtube\"\n)\n\nfunc main() {\n\t// get the video object (with metdata)\n\tvideo, err := youtube.Get(\"FTl0tl9BGdc\")\n\n\t// download the video and write to file\n\toption := \u0026youtube.Option{\n\t\tRename: true,  // rename file using video title\n\t\tResume: true,  // resume cancelled download\n\t\tMp3:    true,  // extract audio to MP3\n\t}\n\tvideo.Download(0, \"video.mp4\", option)\n}\n```\n\n\n## Contributors\n\nBatbold Dashzeveg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknadh%2Fgo-get-youtube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknadh%2Fgo-get-youtube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknadh%2Fgo-get-youtube/lists"}