YouTube API . search

Instance Methods

list(part, videoCaption=None, onBehalfOfContentOwner=None, pageToken=None, type=None, topicId=None, videoDimension=None, videoLicense=None, maxResults=None, videoDuration=None, videoDefinition=None, relatedToVideo=None, q=None, published=None, order=None)

Universal search for youtube.

list_next(previous_request, previous_response)

Retrieves the next page of results.

Method Details

list(part, videoCaption=None, onBehalfOfContentOwner=None, pageToken=None, type=None, topicId=None, videoDimension=None, videoLicense=None, maxResults=None, videoDuration=None, videoDefinition=None, relatedToVideo=None, q=None, published=None, order=None)
Universal search for youtube.

Args:
  part: string, Search result parts to include in the returned response. Valid values are: id and snippet. (required)
  videoCaption: string, Add a filter on the the presence of captions on the videos.
    Allowed values
      any - No filter on the captions.
      closedCaption - Videos with closed captions.
      none - Videos without captions.
  onBehalfOfContentOwner: string, The authenticated user acts on behalf of this content owner.
  pageToken: string, Token for the page selection.
  type: string, Type of resource to search.
  topicId: string, Only search for resources with the specified topic
  videoDimension: string, Add a filter for the number of dimensions in the videos.
    Allowed values
      2d - Videos in two dimensions.
      3d - Videos in three dimensions.
      any - No filter on the dimension.
  videoLicense: string, Add a filter on the licensing of the videos.
    Allowed values
      any - No filter on the license.
      creativeCommon - Videos under the Creative Common license.
      youtube - Videos under the YouTube license.
  maxResults: integer, Maximum number of search results to return per page.
  videoDuration: string, Add a filter on the duration of the videos.
    Allowed values
      any - No filter on the duration.
      long - Videos with a duration longer than 20 minutes.
      medium - Videos with a duration between 4 and 20 minutes.
      short - Videos with a duration under 4 minutes.
  videoDefinition: string, Add a filter for the definition of the videos.
    Allowed values
      any - No filter on the definition.
      high - Videos in high definition.
      standard - Videos in standard definition.
  relatedToVideo: string, Search for resources related to this video. Need to be used with type set to 'video'
  q: string, Query to search in Youtube.
  published: string, Only search for resources uploaded at a specific pediod
    Allowed values
      any - No filter on the release date
      thisWeek - Videos uploaded this month
      today - Videos uploaded today
  order: string, Sort order.
    Allowed values
      date - Sort according to the date.
      rating - Sort according to the rating.
      relevance - Sort according to the relevance.
      view_count - Sort according to the view count.

Returns:
  An object of the form:

    { # A paginated list of search results returned as the response to a youtube.search.list call.
    "nextPageToken": "A String", # Token to the next page.
    "kind": "youtube#searchListResponse", # The type of this API response.
    "items": [ # List of results matching the request criteria.
      { # A search result contains information about a YouTube video, channel, or playlist that matches the search parameters specified in an API request.
        "snippet": { # Basic details about a search result, including title, description and thumbnails of the item referenced by the search result. # Basic details about the search result: title, description, author.
          "title": "A String", # Title of the found resource.
          "channelId": "A String", # Channel publishing the found resource.
          "description": "A String", # Description of the found resource.
          "publishedAt": "A String", # Date and time the found resource was published at.
          "thumbnails": { # Thumbnails for the found resource.
            "a_key": { # A thumbnail is an image representing a YouTube resource. # A map of thumbnails by their name.
              "url": "A String", # The URL for the thumbnail.
            },
          },
        },
        "kind": "youtube#searchResult", # The type of this API resource.
        "etag": "A String", # The eTag of the search result.
        "id": { # A resource id is a generic reference that points to another YouTube resource. # The id of the resource.
          "kind": "A String", # The kind of the referred resource.
          "channelId": "A String", # ID of the referred channel. Present only when type is "CHANNEL".
          "playlistId": "A String", # ID of the referred playlist. Present only when type is "PLAYLIST".
          "videoId": "A String", # ID of the referred video. Present only when type is "VIDEO".
        },
      },
    ],
    "etag": "A String", # The eTag of the response.
    "prevPageToken": "A String", # Token to the previous page.
    "pageInfo": { # Paging details for lists of resources, including total number of items available and number of resources returned in a single page. # Paging information for the search result.
      "totalResults": 42, # The total number of results.
      "resultsPerPage": 42, # The number of results to display for each page.
    },
  }
list_next(previous_request, previous_response)
Retrieves the next page of results.

Args:
  previous_request: The request for the previous page. (required)
  previous_response: The response from the request for the previous page. (required)

Returns:
  A request object that you can call 'execute()' on to request the next
  page. Returns None if there are no more items in the collection.