{"id":17661635,"url":"https://github.com/djthorpe/ytapi","last_synced_at":"2025-05-07T18:09:15.343Z","repository":{"id":57554636,"uuid":"54843355","full_name":"djthorpe/ytapi","owner":"djthorpe","description":"YouTube API Command-Line Interface","archived":false,"fork":false,"pushed_at":"2023-04-17T03:17:17.000Z","size":9610,"stargazers_count":16,"open_issues_count":6,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-07T18:04:17.169Z","etag":null,"topics":["api","api-client","golang","video","youtube","youtube-api"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/djthorpe.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-03-27T18:54:43.000Z","updated_at":"2024-12-15T04:48:41.000Z","dependencies_parsed_at":"2024-06-20T08:24:24.651Z","dependency_job_id":"17dfe7af-c5ee-4764-974f-94004d9c08dd","html_url":"https://github.com/djthorpe/ytapi","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djthorpe%2Fytapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djthorpe%2Fytapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djthorpe%2Fytapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/djthorpe%2Fytapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/djthorpe","download_url":"https://codeload.github.com/djthorpe/ytapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931532,"owners_count":21827111,"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":["api","api-client","golang","video","youtube","youtube-api"],"created_at":"2024-10-23T17:22:42.631Z","updated_at":"2025-05-07T18:09:15.212Z","avatar_url":"https://github.com/djthorpe.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\n# ytapi: YouTube API Command-Line Interface\n\n## Introduction\n\nThis command-line utility operates on the YouTube API's in \norder to list, update, delete and search various YouTube objects (for example,\nchannels, videos, playlists, live streams, analytics reports, claims, assets,\npolicies....)\n\nIt implements most of the API calls and allows you to tailor the resulting data \nin a number of forms (text, CSV). You can distribute the binary widely and it \nwill use the authentication credentials you specify when building your binary \npackage.\n\nFuture versions of the tool may also:\n\n  * Output SQL \u0026 JSON as well as CSV\n  * Allow batch input of information\n\n## Usage\n\nUsage:\n  * `ytapi \u003cflags\u003e \u003ccall\u003e` Execute an API call\n\nIn order to get help:\n\n  * `ytapi -help` will display a list of commands that can be used\n  * `ytapi -help \u003ccall\u003e` will display flags and output fields for a particular API call\n\nHere is a list of the main flags which can be used on the command line:\n\n  * `-credentials=\u003cfoldername\u003e` Folder where credentials are stored\n  * `-channel=\u003cchannel\u003e` Set the channel to act on behalf of\n  * `-contentowner=\u003ccontentowner\u003e` Set the content owner\n  * `-debug` Debug API calls, output API requests and responses to stderr\n  \nThe following commands affect the input and output of data:\n\n  * `-out=(\u003cfilename\u003e.)\u003ccsv|ascii\u003e` Output format for displaying results \n  * `-fields=(+|-)(\u003cfield|part\u003e),...` Which fields to include or exclude in output\n\n## A note on authentication credentials\n\nThe software allows you to authenticate in two ways against YouTube to read,\ncreate, modify and delete information on YouTube:\n\n * *Authentication using OAuth2* This method ties the tool to running against\n   a specific channel, which you specify by using your web browser. It requires\n   the installation of credentials called a \"Client Secret\" which can be\n   downloaded from the Google Developers Console\n * *Authentication using a Service Account* This method ties the tool to a\n   service account (and associated email address) which allows you to access\n   data without having to authenticate before use. You can use this \n   authentication technique to use the YouTube Partner API in addition to the\n   YouTube Data API. It requires installation of service account credentials\n   which can be downloaded from the Google Developers Console\n   \nIn either case, you will need to enable the YouTube API's in your project, \nalso accessible through the Google Developers Console. If using service\naccounts, you will also need to add the service account email to your YouTube\nContent ID user access list.\n\n## Building the tool\n\nIn order to build the tool, please download the latest version from the\nreleases page here:\n\n  https://github.com/djthorpe/ytapi/releases\n\nThe resulting 'ytapi' folder will have a build script under the build folder.\nIf you have git and go installed, you can then build the software as follows:\n\n```\n  ytapi% build/build.sh\n```\n\nIn most cases, you might want to distribute your binary tool with credentials\n\"baked in\" so that your users can start using the tool without going through\nadditional installation steps. In order to \"bake in\" credentials for client \nsecrets and service accounts, you can specify the location of those files on \nthe build command line. You can download these credentials from your Google \nDevelopers Console:\n\n  https://developers.google.com/youtube/analytics/registering_an_application\n  \nYou can use the `-c` and `-s` flags in order to do this. For example,\n\n```\n  ytapi% build/build.sh -c ~/.ytapi/client_secret.json -s ~/.ytapi/service_account.json\n```\n\nBe aware that if you bake in the credentials, anyone making API calls will impact\nyour API quota, so you should keep an eye on your Google Cloud Console to ensure\nthe tool isn't being mis-used. In addition, anyone using your service account\ncredentials within their YouTube Content Management system gives you access to\ntheir CMS system, so be careful when distributing the tool when there are\nservice account credentials baked into the binary.\n\n## Distribution of your tool\n\nOnce you have a binary, you can distribute your tool and people can start using it\nby putting the binary in their search path. When they run the tool for the first\ntime, they can use the \"Install\" command to create the local credentials. For example,\n\n```\n  home% ytapi Install\n  home% ytapi ListVideos\n```\n\nIf you wish to have several different sets of credentials, you can use the\n`-credentials` flag to indicate which set. The default value is `.ytapi` but\nyou can select a different set of credentials as follows:\n\n```\n  home% ytapi -credentials=.ytapi2 Install\n  home% ytapi -credentials=.ytapi2 ListVideos\n```\n\nThe `Authenticate` command will refresh the OAuth or Service Account tokens\nand allow you to set required scopes of operation. In order to authenticate\nagainst a YouTube channel, use the following form:\n\n```\n  home% ytapi Authenticate\n```\n\nTo authenticate using service account credentials against a named content\nowner, use the following form:\n\n```\n  home% ytapi -sa -contentowner=\u003ccontentowner\u003e Authenticate\n```\n\nThis will display a list of channels which the content owner manages. Subsequent\ncalls will use the same content owner information, so no need to append the\n`-contentowner` flag unless you want to reauthenticate. Finally, you can specify\na default channel when using service accounts:\n\n```\n  home% ytapi -contentowner=\u003ccontentowner\u003e -channel=\u003cchannel\u003e Authenticate\n```\n\nThis sets the default channel on which to operate YouTube API calls. By default,\nauthentication will set the scopes (or \"permissions\") of operation to the Data API.\nIn order to gain other permissions, use the `-scope` flag. For example,\n\n```\n  home% ytapi -contentowner=\u003ccontentowner\u003e -scope=data,partner Authenticate\n```\n\nHere is the list of scopes of operation:\n\n| Scope  | Permissions |\n| ------ | ----------- |\n| data | Manage YouTube channel account |\n| dataread | Read-only access to YouTube channel account |\n| upload | Ability to upload to YouTube channel account |\n| partner | Manage YouTube partner account |\n| audit | View private information during the audit process with a partner |\n| analytics | Access YouTube analytics |\n| revenue | Access YouTube analytics revenue data |\n| all | All YouTube permissions |\n\nBy default, the scope set is only \"data\"\n\n## Parameters to make API calls\n\n## Fields and Parts on output\n\n## Batch input\n\n## API Call Reference\n\nThe following sections list the calls that can be made to the YouTube Data and\nPartner API's.\n\n### Installation and Authentication operations\n\n\tAuthenticate\n\t\tAuthenticate against service account or channel\n\n### Operations on Channels\n\n\tListChannels\n\t\tList channels\n\n### Channel Section operations\n\n\tListChannelSections\n\t\tList channel sections\n\n### Operations on videos\n\n\tListVideos\n\t\tList videos\n\tGetVideo\n\t\tGet single video\n\n### Operations on Broadcasts\n\n\tListBroadcasts\n\t\tList broadcasts\n\tDeleteBroadcast\n\t\tDelete broadcast\n\tTransitionBroadcast\n\t\tTransition broadcast to another state\n\tBindBroadcast\n\t\tBind or unbind broadcast to stream\n\tNewBroadcast\n\t\tCreate a new broadcast\n\n### Operations on Streams\n\n\tListStreams\n\t\tList streams\n\tDeleteStream\n\t\tDelete stream\n\n### Operations on video captions\n\n\tListCaptions\n\t\tList captions\n\n### Operations on Playlists\n\n\tListPlaylists\n\t\tList playlists for channel\n\tNewPlaylist\n\t\tCreate a new playlist\n\tDeletePlaylist\n\t\tDelete an existing playlist\n\tUpdatePlaylist\n\t\tUpdate playlist metadata\n\n### Operations on PlaylistItems\n\n\tListPlaylistItems\n\t\tList playlist items for a playlist\n\tInsertVideoIntoPlaylist\n\t\tInserts a video into a playlist\n\tDeleteVideoFromPlaylist\n\t\tDeletes a video from a playlist\n\n### Language and Region operations\n\n\tListLanguages\n\t\tList languages\n\tListRegions\n\t\tList regions\n\n### Search operations\n\n\tSearchVideos\n\t\tSearch for videos based on text query or related video\n\tSearchBroadcasts\n\t\tSearch for live broadcasts\n\tSearchPlaylists\n\t\tSearch for playlists based on text query\n\tSearchChannels\n\t\tSearch for channels\n\n### Content owner operations\n\n\tListContentOwners\n\t\tList content owners\n\n### Policy operations\n\n\tListPolicies\n\t\tList policies\n\n### Claim operations\n\n\tClaim\n\t\tCreate a claim between a video and asset with a defined policy\n\tGetClaim\n\t\tGet Existing claim\n\tListClaims\n\t\tList all claims\n\tClaimHistory\n\t\tList history for a claim\n\tUpdateClaim\n\t\tUpdate an existing claim\n\n### Asset operations\n\n\tGetAsset\n\t\tGet a single asset\n\n### Reference operations\n\n\tListReferences\n\t\tGet a list of references for an asset\n\t\t\n\n\t\t\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjthorpe%2Fytapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdjthorpe%2Fytapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdjthorpe%2Fytapi/lists"}