Youtube · Arazzo Workflow

YouTube Trending Videos to Playlist

Version 1.0.0

Pull the most popular videos for a region, create a playlist, and add the top trending video to it.

1 workflow 1 source API 1 provider
View Spec View on GitHub GoogleMediaSocialStreamingVideoVideosArazzoWorkflows

Provider

youtube

Workflows

trending-to-playlist
Capture the top trending video and save it into a new playlist.
Lists the most popular videos chart, creates a new playlist, and adds the first trending video to that playlist.
3 steps inputs: apiKey, playlistTitle, privacyStatus outputs: playlistId, playlistItemId, topVideoId
1
getTrending
youtube.videos.list
Request the most popular videos chart and capture the top video id.
2
createPlaylist
youtube.playlists.insert
Create a new playlist to hold the trending video.
3
addTrendingVideo
youtube.playlistItems.insert
Insert the top trending video into the new playlist.

Source API Descriptions

Arazzo Workflow Specification

youtube-trending-to-playlist-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: YouTube Trending Videos to Playlist
  summary: Pull the most popular videos for a region, create a playlist, and add the top trending video to it.
  description: >-
    Curates trending content into a saved collection. It requests the most
    popular videos chart for a region, creates a new playlist, and inserts the
    top trending video into that playlist. Every step spells out its request
    inline so the flow can be read and executed without opening the underlying
    OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: youtubeDataApi
  url: ../openapi/youtube-data-api-openapi.yml
  type: openapi
workflows:
- workflowId: trending-to-playlist
  summary: Capture the top trending video and save it into a new playlist.
  description: >-
    Lists the most popular videos chart, creates a new playlist, and adds the
    first trending video to that playlist.
  inputs:
    type: object
    required:
    - apiKey
    - playlistTitle
    properties:
      apiKey:
        type: string
        description: The Google API key used to authorize each YouTube Data API request.
      playlistTitle:
        type: string
        description: The title for the new playlist of trending videos.
      privacyStatus:
        type: string
        description: The privacy status of the new playlist.
        default: private
  steps:
  - stepId: getTrending
    description: Request the most popular videos chart and capture the top video id.
    operationId: youtube.videos.list
    parameters:
    - name: part
      in: query
      value: snippet,statistics
    - name: chart
      in: query
      value: mostPopular
    - name: maxResults
      in: query
      value: 10
    - name: key
      in: query
      value: $inputs.apiKey
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      topVideoId: $response.body#/items/0/id
      topVideoTitle: $response.body#/items/0/snippet/title
  - stepId: createPlaylist
    description: Create a new playlist to hold the trending video.
    operationId: youtube.playlists.insert
    parameters:
    - name: part
      in: query
      value: snippet,status
    - name: key
      in: query
      value: $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        snippet:
          title: $inputs.playlistTitle
        status:
          privacyStatus: $inputs.privacyStatus
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      playlistId: $response.body#/id
  - stepId: addTrendingVideo
    description: Insert the top trending video into the new playlist.
    operationId: youtube.playlistItems.insert
    parameters:
    - name: part
      in: query
      value: snippet
    - name: key
      in: query
      value: $inputs.apiKey
    requestBody:
      contentType: application/json
      payload:
        snippet:
          playlistId: $steps.createPlaylist.outputs.playlistId
          resourceId:
            kind: youtube#video
            videoId: $steps.getTrending.outputs.topVideoId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      playlistItemId: $response.body#/id
  outputs:
    topVideoId: $steps.getTrending.outputs.topVideoId
    playlistId: $steps.createPlaylist.outputs.playlistId
    playlistItemId: $steps.addTrendingVideo.outputs.playlistItemId