← YouTube (Data API)

List Videos with YouTube (Data API) API

Pipedream makes it easy to connect APIs for YouTube (Data API) and 900+ other apps remarkably fast.

Trigger workflow on
HTTP requests, schedules and app events
Next, do this
List Videos with the YouTube (Data API) API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

Create a workflow to List Videos with the YouTube (Data API) API. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Configure the List Videos action
    1. Connect your YouTube (Data API) account
    2. Select a Use Case
  2. Select a trigger to run your workflow on HTTP requests, schedules or app events
  3. Deploy the workflow
  4. Send a test event to validate your setup
  5. Turn on the trigger

Integrations

List Videos with YouTube (Data API) API on New Requests (Payload Only) from HTTP / Webhook API
HTTP / Webhook + YouTube (Data API)
 
Try it
List Videos with YouTube (Data API) API on New Message from Discord API
Discord + YouTube (Data API)
 
Try it
List Videos with YouTube (Data API) API on New Message in Channel from Discord Bot API
Discord Bot + YouTube (Data API)
 
Try it
List Videos with YouTube (Data API) API on New Submission from Typeform API
Typeform + YouTube (Data API)
 
Try it
List Videos with YouTube (Data API) API on Custom Events from Zoom API
Zoom + YouTube (Data API)
 
Try it

Details

This is a pre-built, open source component from Pipedream's GitHub repo. The component is developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

List Videos on YouTube (Data API)
Description:Returns a list of videos that match the API request parameters. [See the docs](https://developers.google.com/youtube/v3/docs/videos/list) for more information
Version:0.0.1
Key:youtube_data_api-list-videos

Code

import youtubeDataApi from "../../youtube_data_api.app.mjs";
import consts from "../../consts.mjs";

export default {
  key: "youtube_data_api-list-videos",
  name: "List Videos",
  description: "Returns a list of videos that match the API request parameters. [See the docs](https://developers.google.com/youtube/v3/docs/videos/list) for more information",
  version: "0.0.1",
  type: "action",
  props: {
    youtubeDataApi,
    useCase: {
      propDefinition: [
        youtubeDataApi,
        "useCase",
      ],
      options: consts.LIST_VIDEOS_USE_CASES,
    },
  },
  async additionalProps() {
    const dynamicProps = {};
    if (this.useCase === "id") {
      dynamicProps.id = {
        ...youtubeDataApi.propDefinitions.channelId,
      };
    }
    else if (this.useCase === "myRating") {
      dynamicProps.myRating = {
        label: "My Rating",
        description: "Set this parameter's value to like or dislike to instruct the API to only return videos liked or disliked by the authenticated user.",
        type: "string",
        options: consts.LIST_VIDEOS_MY_RATING_OPTS,
      };
    }
    else if (this.useCase === "chart") {
      dynamicProps.regionCode = {
        ...youtubeDataApi.propDefinitions.regionCode,
      };
      if (this.regionCode && this.regionCode.length === 2) {
        dynamicProps.videoCategoryId = {
          label: "Video Category Id",
          description: "The videoCategoryId parameter identifies the video category for which the chart should be retrieved. By default, charts are not restricted to a particular category.",
          type: "string",
          optional: true,
          options: async () => {
            return await this.youtubeDataApi.listVideoCategoriesOpts(this.regionCode);
          },
        };
      }
    }
    return {
      ...dynamicProps,
      part: {
        ...youtubeDataApi.propDefinitions.part,
        options: consts.LIST_VIDEOS_PART_OPTS,
      },
      hl: {
        ...youtubeDataApi.propDefinitions.hl,
        options: async () => {
          return await this.youtubeDataApi.listI18nLanguagesOpts();
        },
      },
      maxResults: {
        ...youtubeDataApi.propDefinitions.maxResults,
      },
      maxHeight: {
        label: "Max Height",
        description: "The maxHeight parameter specifies the maximum height of the embedded player returned in the player.embedHtml property. You can use this parameter to specify that instead of the default dimensions, If the maxWidth parameter is also provided, the player may be shorter than the maxHeight in order to not violate the maximum width.",
        type: "integer",
        min: 72,
        max: 8192,
        optional: true,
      },
      maxWidth: {
        label: "Max Height",
        description: "The maxWidth parameter specifies the maximum width of the embedded player returned in the player.embedHtml property.\nYou can use this parameter to specify that instead of the default dimensions.",
        type: "integer",
        min: 72,
        max: 8192,
        optional: true,
      },
    };
  },
  async run({ $ }) {
    const {
      useCase,
      id,
      myRating,
      part,
      hl,
      maxHeight,
      maxWidth,
      maxResults,
      videoCategoryId,
      regionCode,
    } = this;

    const chart = useCase === "chart" ?
      "mostPopular" :
      undefined;

    const videos = (await this.youtubeDataApi.listVideos({
      part,
      id,
      chart,
      myRating,
      hl,
      maxHeight,
      maxWidth,
      maxResults,
      videoCategoryId,
      regionCode,
    })).data;
    $.export("$summary", `Successfully fetched "${videos.items.length}" videos`);
    return videos;
  },
};

Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
YouTube (Data API)youtubeDataApiappThis component uses the YouTube (Data API) app.
Use CaseuseCasestringSelect a value from the drop down menu:{ "label": "By video id", "value": "id" }{ "label": "Most popular videos", "value": "chart" }{ "label": "My liked videos", "value": "myRating" }

Authentication

YouTube (Data API) uses OAuth authentication. When you connect your YouTube (Data API) account, Pipedream will open a popup window where you can sign into YouTube (Data API) and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any YouTube (Data API) API.

Pipedream requests the following authorization scopes when you connect your account:

emailprofilehttps://www.googleapis.com/auth/youtube.readonlyhttps://www.googleapis.com/auth/youtube.uploadhttps://www.googleapis.com/auth/youtube

About YouTube (Data API)

Online video platform

More Ways to Use YouTube (Data API)

Triggers

New Liked Videos from the YouTube (Data API) API

Emit new event for each new Youtube video liked by the authenticated user.

 
Try it
New Subscriber from the YouTube (Data API) API

Emit new event for each new Youtube subscriber to user Channel.

 
Try it
New Subscription from the YouTube (Data API) API

Emit new event for each new subscription from authenticated user.

 
Try it
New Videos from the YouTube (Data API) API

Emit new event for each new Youtube video the user posts.

 
Try it
New Videos by Location from the YouTube (Data API) API

Emit new event for each new YouTube video tied to a location.

 
Try it

Actions

Channel Statistics with the YouTube (Data API) API

Returns statistics from my YouTube Channel or by id. See the docs for more information

 
Try it
List Activities with the YouTube (Data API) API

Returns a list of channel activity events that match the request criteria. See the docs for more information

 
Try it
List Playlists with the YouTube (Data API) API

Returns a collection of playlists that match the API request parameters. See the docs for more information

 
Try it
Update Playlist with the YouTube (Data API) API

Modifies a playlist. For example, you could change a playlist's title, description, or privacy status. If you are submitting an update request, and your request does not specify a value for a property that already has a value, the property's existing value will be deleted. See the docs for more information

 
Try it
Upload Video with the YouTube (Data API) API

Post a video to your channel. See the docs for more information

 
Try it