0.0.20240507 • Published 1 day ago

@maxim_mazurok/gapi.client.youtube-v3 v0.0.20240507

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

TypeScript typings for YouTube Data API v3 v3

The YouTube Data API v3 is an API that provides access to YouTube data, such as videos, playlists, and channels. For detailed description please check documentation.

Installing

Install typings for YouTube Data API v3:

npm install @types/gapi.client.youtube-v3 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load(
  'https://youtube.googleapis.com/$discovery/rest?version=v3',
  () => {
    // now we can use:
    // gapi.client.youtube
  }
);
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
gapi.client.load('youtube', 'v3', () => {
  // now we can use:
  // gapi.client.youtube
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [
    // Manage your YouTube account
    'https://www.googleapis.com/auth/youtube',

    // See a list of your current active channel members, their current level, and when they became a member
    'https://www.googleapis.com/auth/youtube.channel-memberships.creator',

    // See, edit, and permanently delete your YouTube videos, ratings, comments and captions
    'https://www.googleapis.com/auth/youtube.force-ssl',

    // View your YouTube account
    'https://www.googleapis.com/auth/youtube.readonly',

    // Manage your YouTube videos
    'https://www.googleapis.com/auth/youtube.upload',

    // View and manage your assets and associated content on YouTube
    'https://www.googleapis.com/auth/youtubepartner',

    // View private information of your YouTube channel relevant during the audit process with a YouTube partner
    'https://www.googleapis.com/auth/youtubepartner-channel-audit',
  ],
  immediate = true;
// ...

gapi.auth.authorize(
  {client_id: client_id, scope: scope, immediate: immediate},
  authResult => {
    if (authResult && !authResult.error) {
      /* handle successful authorization */
    } else {
      /* handle authorization error */
    }
  }
);

After that you can use YouTube Data API v3 resources:

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.abuseReports.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.activities.list({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.captions.delete({id: 'id'});

/*
Downloads a caption track.
*/
await gapi.client.youtube.captions.download({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.captions.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.captions.list({part: 'part', videoId: 'videoId'});

/*
Updates an existing resource.
*/
await gapi.client.youtube.captions.update({part: 'part'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.channelBanners.insert({});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.channels.list({part: 'part'});

/*
Updates an existing resource.
*/
await gapi.client.youtube.channels.update({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.channelSections.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.channelSections.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.channelSections.list({part: 'part'});

/*
Updates an existing resource.
*/
await gapi.client.youtube.channelSections.update({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.comments.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.comments.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.comments.list({part: 'part'});

/*
Expresses the caller's opinion that one or more comments should be flagged as spam.
*/
await gapi.client.youtube.comments.markAsSpam({id: 'id'});

/*
Sets the moderation status of one or more comments.
*/
await gapi.client.youtube.comments.setModerationStatus({
  id: 'id',
  moderationStatus: 'moderationStatus',
});

/*
Updates an existing resource.
*/
await gapi.client.youtube.comments.update({part: 'part'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.commentThreads.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.commentThreads.list({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.i18nLanguages.list({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.i18nRegions.list({part: 'part'});

/*
Bind a broadcast to a stream.
*/
await gapi.client.youtube.liveBroadcasts.bind({id: 'id', part: 'part'});

/*
Delete a given broadcast.
*/
await gapi.client.youtube.liveBroadcasts.delete({id: 'id'});

/*
Inserts a new stream for the authenticated user.
*/
await gapi.client.youtube.liveBroadcasts.insert({part: 'part'});

/*
Insert cuepoints in a broadcast
*/
await gapi.client.youtube.liveBroadcasts.insertCuepoint({});

/*
Retrieve the list of broadcasts associated with the given channel.
*/
await gapi.client.youtube.liveBroadcasts.list({part: 'part'});

/*
Transition a broadcast to a given status.
*/
await gapi.client.youtube.liveBroadcasts.transition({
  broadcastStatus: 'broadcastStatus',
  id: 'id',
  part: 'part',
});

/*
Updates an existing broadcast for the authenticated user.
*/
await gapi.client.youtube.liveBroadcasts.update({part: 'part'});

/*
Deletes a chat ban.
*/
await gapi.client.youtube.liveChatBans.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.liveChatBans.insert({part: 'part'});

/*
Deletes a chat message.
*/
await gapi.client.youtube.liveChatMessages.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.liveChatMessages.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.liveChatMessages.list({
  liveChatId: 'liveChatId',
  part: 'part',
});

/*
Deletes a chat moderator.
*/
await gapi.client.youtube.liveChatModerators.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.liveChatModerators.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.liveChatModerators.list({
  liveChatId: 'liveChatId',
  part: 'part',
});

/*
Deletes an existing stream for the authenticated user.
*/
await gapi.client.youtube.liveStreams.delete({id: 'id'});

/*
Inserts a new stream for the authenticated user.
*/
await gapi.client.youtube.liveStreams.insert({part: 'part'});

/*
Retrieve the list of streams associated with the given channel. --
*/
await gapi.client.youtube.liveStreams.list({part: 'part'});

/*
Updates an existing stream for the authenticated user.
*/
await gapi.client.youtube.liveStreams.update({part: 'part'});

/*
Retrieves a list of members that match the request criteria for a channel.
*/
await gapi.client.youtube.members.list({part: 'part'});

/*
Retrieves a list of all pricing levels offered by a creator to the fans.
*/
await gapi.client.youtube.membershipsLevels.list({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.playlistImages.delete({});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.playlistImages.insert({});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.playlistImages.list({});

/*
Updates an existing resource.
*/
await gapi.client.youtube.playlistImages.update({});

/*
Deletes a resource.
*/
await gapi.client.youtube.playlistItems.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.playlistItems.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.playlistItems.list({part: 'part'});

/*
Updates an existing resource.
*/
await gapi.client.youtube.playlistItems.update({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.playlists.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.playlists.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.playlists.list({part: 'part'});

/*
Updates an existing resource.
*/
await gapi.client.youtube.playlists.update({part: 'part'});

/*
Retrieves a list of search resources
*/
await gapi.client.youtube.search.list({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.subscriptions.delete({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.subscriptions.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.subscriptions.list({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.superChatEvents.list({part: 'part'});

/*
POST method.
*/
await gapi.client.youtube.tests.insert({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.thirdPartyLinks.delete({
  linkingToken: 'linkingToken',
  type: 'type',
});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.thirdPartyLinks.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.thirdPartyLinks.list({part: 'part'});

/*
Updates an existing resource.
*/
await gapi.client.youtube.thirdPartyLinks.update({part: 'part'});

/*
As this is not an insert in a strict sense (it supports uploading/setting of a thumbnail for multiple videos, which doesn't result in creation of a single resource), I use a custom verb here.
*/
await gapi.client.youtube.thumbnails.set({videoId: 'videoId'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.videoAbuseReportReasons.list({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.videoCategories.list({part: 'part'});

/*
Deletes a resource.
*/
await gapi.client.youtube.videos.delete({id: 'id'});

/*
Retrieves the ratings that the authorized user gave to a list of specified videos.
*/
await gapi.client.youtube.videos.getRating({id: 'id'});

/*
Inserts a new resource into this collection.
*/
await gapi.client.youtube.videos.insert({part: 'part'});

/*
Retrieves a list of resources, possibly filtered.
*/
await gapi.client.youtube.videos.list({part: 'part'});

/*
Adds a like or dislike rating to a video or removes a rating from a video.
*/
await gapi.client.youtube.videos.rate({id: 'id', rating: 'rating'});

/*
Report abuse for a video.
*/
await gapi.client.youtube.videos.reportAbuse({});

/*
Updates an existing resource.
*/
await gapi.client.youtube.videos.update({part: 'part'});

/*
Allows upload of watermark image and setting it for a channel.
*/
await gapi.client.youtube.watermarks.set({channelId: 'channelId'});

/*
Allows removal of channel watermark.
*/
await gapi.client.youtube.watermarks.unset({channelId: 'channelId'});
0.0.20240507

1 day ago

0.0.20240505

3 days ago

0.0.20240501

7 days ago

0.0.20240429

9 days ago

0.0.20240428

10 days ago

0.0.20240424

14 days ago

0.0.20240423

15 days ago

0.0.20240422

16 days ago

0.0.20240421

17 days ago

0.0.20240417

21 days ago

0.0.20240414

24 days ago

0.0.20240409

29 days ago

0.0.20240407

1 month ago

0.0.20240403

1 month ago

0.0.20240401

1 month ago

0.0.20240326

1 month ago

0.0.20240325

1 month ago

0.0.20240324

2 months ago

0.0.20240320

2 months ago

0.0.20240319

2 months ago

0.0.20240318

2 months ago

0.0.20240317

2 months ago

0.0.20240310

2 months ago

0.0.20240312

2 months ago

0.0.20240307

2 months ago

0.0.20240305

2 months ago

0.0.20240304

2 months ago

0.0.20240303

2 months ago

0.0.20240226

2 months ago

0.0.20240225

2 months ago

0.0.20240221

3 months ago

0.0.20240220

3 months ago

0.0.20240213

3 months ago

0.0.20240211

3 months ago

0.0.20240207

3 months ago

0.0.20240206

3 months ago

0.0.20240205

3 months ago

0.0.20240204

3 months ago

0.0.20240130

3 months ago

0.0.20240131

3 months ago

0.0.20240129

3 months ago

0.0.20240128

3 months ago

0.0.20240123

4 months ago

0.0.20240121

4 months ago

0.0.20240115

4 months ago

0.0.20240110

4 months ago

0.0.20240109

4 months ago

0.0.20240108

4 months ago

0.0.20240107

4 months ago

0.0.20240103

4 months ago

0.0.20240101

4 months ago

0.0.20240102

4 months ago

0.0.20231219

5 months ago

0.0.20231215

5 months ago

0.0.20231213

5 months ago

0.0.20231212

5 months ago

0.0.20231210

5 months ago

0.0.20231211

5 months ago

0.0.20231205

5 months ago

0.0.20231204

5 months ago

0.0.20231203

5 months ago

0.0.20231128

5 months ago

0.0.20230818

9 months ago

0.0.20230816

9 months ago

0.0.20231106

6 months ago

0.0.20231105

6 months ago

0.0.20231108

6 months ago

0.0.20231107

6 months ago

0.0.20230814

9 months ago

0.0.20230813

9 months ago

0.0.20231113

6 months ago

0.0.20231112

6 months ago

0.0.20231115

6 months ago

0.0.20231114

6 months ago

0.0.20230807

9 months ago

0.0.20230808

9 months ago

0.0.20230926

8 months ago

0.0.20230927

7 months ago

0.0.20230806

9 months ago

0.0.20230809

9 months ago

0.0.20230920

8 months ago

0.0.20230924

8 months ago

0.0.20230925

8 months ago

0.0.20230801

9 months ago

0.0.20231101

6 months ago

0.0.20230719

10 months ago

0.0.20230717

10 months ago

0.0.20230718

10 months ago

0.0.20230711

10 months ago

0.0.20231127

5 months ago

0.0.20230712

10 months ago

0.0.20231009

7 months ago

0.0.20230830

8 months ago

0.0.20231008

7 months ago

0.0.20230710

10 months ago

0.0.20230716

10 months ago

0.0.20231011

7 months ago

0.0.20230829

8 months ago

0.0.20230708

10 months ago

0.0.20230827

9 months ago

0.0.20230828

8 months ago

0.0.20230822

9 months ago

0.0.20231119

6 months ago

0.0.20230704

10 months ago

0.0.20230705

10 months ago

0.0.20230823

9 months ago

0.0.20231120

6 months ago

0.0.20231003

7 months ago

0.0.20231002

7 months ago

0.0.20231126

5 months ago

0.0.20231004

7 months ago

0.0.20231029

6 months ago

0.0.20231031

6 months ago

0.0.20231030

6 months ago

0.0.20231018

7 months ago

0.0.20231017

7 months ago

0.0.20230723

10 months ago

0.0.20230726

10 months ago

0.0.20230724

10 months ago

0.0.20230725

10 months ago

0.0.20231023

7 months ago

0.0.20231022

7 months ago

0.0.20231024

7 months ago

0.0.20230730

9 months ago

0.0.20231026

7 months ago

0.0.20230628

11 months ago

0.0.20230917

8 months ago

0.0.20230918

8 months ago

0.0.20230910

8 months ago

0.0.20230913

8 months ago

0.0.20230911

8 months ago

0.0.20230912

8 months ago

0.0.20230906

8 months ago

0.0.20230904

8 months ago

0.0.20230905

8 months ago

0.0.20230627

11 months ago

0.0.20230524

12 months ago

0.0.20230522

12 months ago

0.0.20230523

12 months ago

0.0.20230529

12 months ago

0.0.20230531

11 months ago

0.0.20230530

11 months ago

0.0.20230619

11 months ago

0.0.20230612

11 months ago

0.0.20230613

11 months ago

0.0.20230611

11 months ago

0.0.20230614

11 months ago

0.0.20230620

11 months ago

0.0.20230607

11 months ago

0.0.20230605

11 months ago

0.0.20230606

11 months ago

0.0.20230604

11 months ago

0.0.20230514

12 months ago

0.0.20230515

12 months ago

0.0.20230516

12 months ago

0.0.20230521

12 months ago

0.0.20230508

1 year ago

0.0.20230509

1 year ago

0.0.20230502

1 year ago

0.0.20230503

1 year ago

0.0.20230501

1 year ago

0.0.20230505

1 year ago

0.0.20230510

12 months ago

0.0.20230412

1 year ago

0.0.20230418

1 year ago

0.0.20230419

1 year ago

0.0.20230416

1 year ago

0.0.20230417

1 year ago

0.0.20230301

1 year ago

0.0.20230404

1 year ago

0.0.20230402

1 year ago

0.0.20230410

1 year ago

0.0.20230315

1 year ago

0.0.20230316

1 year ago

0.0.20230314

1 year ago

0.0.20230319

1 year ago

0.0.20230322

1 year ago

0.0.20230323

1 year ago

0.0.20230321

1 year ago

0.0.20230426

1 year ago

0.0.20230305

1 year ago

0.0.20230302

1 year ago

0.0.20230424

1 year ago

0.0.20230308

1 year ago

0.0.20230309

1 year ago

0.0.20230307

1 year ago

0.0.20230326

1 year ago

0.0.20230328

1 year ago

0.0.20230329

1 year ago

0.0.20230330

1 year ago

0.0.20230227

1 year ago

0.0.20230216

1 year ago

0.0.20230214

1 year ago

0.0.20230220

1 year ago

0.0.20230223

1 year ago

0.0.20230222

1 year ago

0.0.20230206

1 year ago

0.0.20230129

1 year ago

0.0.20230209

1 year ago

0.0.20230207

1 year ago

0.0.20230208

1 year ago

0.0.20230131

1 year ago

0.0.20230202

1 year ago

0.0.20221115

1 year ago

0.0.20221114

1 year ago

0.0.20221112

1 year ago

0.0.20230102

1 year ago

0.0.20221109

1 year ago

0.0.20230103

1 year ago

0.0.20221108

1 year ago

0.0.20221107

2 years ago

0.0.20221106

2 years ago

0.0.20221220

1 year ago

0.0.20221215

1 year ago

0.0.20230118

1 year ago

0.0.20221213

1 year ago

0.0.20230116

1 year ago

0.0.20221212

1 year ago

0.0.20221211

1 year ago

0.0.20230124

1 year ago

0.0.20221207

1 year ago

0.0.20230122

1 year ago

0.0.20221206

1 year ago

0.0.20230123

1 year ago

0.0.20221205

1 year ago

0.0.20221204

1 year ago

0.0.20230104

1 year ago

0.0.20221201

1 year ago

0.0.20221031

2 years ago

0.0.20221017

2 years ago

0.0.20221016

2 years ago

0.0.20221013

2 years ago

0.0.20221011

2 years ago

0.0.20221009

2 years ago

0.0.20221029

2 years ago

0.0.20221006

2 years ago

0.0.20221005

2 years ago

0.0.20221026

2 years ago

0.0.20221004

2 years ago

0.0.20221102

2 years ago

0.0.20221025

2 years ago

0.0.20221101

2 years ago

0.0.20221024

2 years ago

0.0.20221023

2 years ago

0.0.20221001

2 years ago

0.0.20220928

2 years ago

0.0.20220929

2 years ago

0.0.20221019

2 years ago

0.0.20221018

2 years ago

0.0.20220917

2 years ago

0.0.20220919

2 years ago

0.0.20220831

2 years ago

0.0.20220910

2 years ago

0.0.20220912

2 years ago

0.0.20220913

2 years ago

0.0.20220914

2 years ago

0.0.20220830

2 years ago

0.0.20220905

2 years ago

0.0.20220906

2 years ago

0.0.20220829

2 years ago

0.0.20220907

2 years ago

0.0.20220920

2 years ago

0.0.20220821

2 years ago

0.0.20220921

2 years ago

0.0.20220822

2 years ago

0.0.20220823

2 years ago

0.0.20220824

2 years ago

0.0.20220826

2 years ago

0.0.20220926

2 years ago

0.0.20220817

2 years ago

0.0.20220816

2 years ago

0.0.20220813

2 years ago

0.0.20220809

2 years ago