YouTube

Uploading a Video

GPAL.YouTube is the entry point and takes its account through WithCredentials, the same ICredentials the rest of GPAL uses. WithTitle and WithDescription set what the video is called and what is written under it. WithTags supplies the search tags it carries, as any number of strings. WithCategory picks the YouTube category it is filed under, and WithPrivacy whether it is Public, Private or Unlisted. WithPlaylist set before the upload puts the video into that playlist as soon as it is up, so a run that uploads into a series does not need a second call. Upload sends the file and answers a YouTubeUploadResult holding the new video's id, its url and its status, and that result is what the scheduling calls take.

NOTE

Uploading Private and scheduling a premiere afterwards is how a video goes up finished rather than appearing while YouTube is still processing it.

Examples

GPAL Fluent: High-level fluent C# API

//Upload is synchronous and returns once YouTube has the bytes. YouTube then processes the video on its own time, which is what the scheduling calls wait on.

YouTubeUploadResult uploaded = GPAL.YouTube

.WithCredentials(credentials)

.WithTitle("Bot of the Week: Release Conductor")

.WithDescription("Flipping 65 project files between project and package references.")

.WithTags("gpal", "automation", "csharp")

.WithCategory(YouTubeCategory.ScienceTechnology)

.WithPrivacy(YouTubePrivacy.Private)

.WithPlaylist(seriesPlaylistId) // added to the playlist as part of the upload

.Upload(@"c: ideosotw-release-conductor.mp4");

💬 Ask GPAL