YouTube Data API v3 . search

Instance Methods

close()

Close httplib2 connections.

list(part, channelId=None, channelType=None, eventType=None, forContentOwner=None, forDeveloper=None, forMine=None, location=None, locationRadius=None, maxResults=None, onBehalfOfContentOwner=None, order=None, pageToken=None, publishedAfter=None, publishedBefore=None, q=None, regionCode=None, relevanceLanguage=None, safeSearch=None, topicId=None, type=None, videoCaption=None, videoCategoryId=None, videoDefinition=None, videoDimension=None, videoDuration=None, videoEmbeddable=None, videoLicense=None, videoPaidProductPlacement=None, videoSyndicated=None, videoType=None, x__xgafv=None)

Retrieves a list of search resources

list_next()

Retrieves the next page of results.

Method Details

close()
Close httplib2 connections.
list(part, channelId=None, channelType=None, eventType=None, forContentOwner=None, forDeveloper=None, forMine=None, location=None, locationRadius=None, maxResults=None, onBehalfOfContentOwner=None, order=None, pageToken=None, publishedAfter=None, publishedBefore=None, q=None, regionCode=None, relevanceLanguage=None, safeSearch=None, topicId=None, type=None, videoCaption=None, videoCategoryId=None, videoDefinition=None, videoDimension=None, videoDuration=None, videoEmbeddable=None, videoLicense=None, videoPaidProductPlacement=None, videoSyndicated=None, videoType=None, x__xgafv=None)
Retrieves a list of search resources

Args:
  part: string, The *part* parameter specifies a comma-separated list of one or more search resource properties that the API response will include. Set the parameter value to snippet. (required) (repeated)
  channelId: string, Filter on resources belonging to this channelId.
  channelType: string, Add a filter on the channel search.
    Allowed values
      channelTypeUnspecified - 
      any - Return all channels.
      show - Only retrieve shows.
  eventType: string, Filter on the livestream status of the videos.
    Allowed values
      none - 
      upcoming - The live broadcast is upcoming.
      live - The live broadcast is active.
      completed - The live broadcast has been completed.
  forContentOwner: boolean, Search owned by a content owner.
  forDeveloper: boolean, Restrict the search to only retrieve videos uploaded using the project id of the authenticated user.
  forMine: boolean, Search for the private videos of the authenticated user.
  location: string, Filter on location of the video
  locationRadius: string, Filter on distance from the location (specified above).
  maxResults: integer, The *maxResults* parameter specifies the maximum number of items that should be returned in the result set.
  onBehalfOfContentOwner: string, *Note:* This parameter is intended exclusively for YouTube content partners. The *onBehalfOfContentOwner* parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value. This parameter is intended for YouTube content partners that own and manage many different YouTube channels. It allows content owners to authenticate once and get access to all their video and channel data, without having to provide authentication credentials for each individual channel. The CMS account that the user authenticates with must be linked to the specified YouTube content owner.
  order: string, Sort order of the results.
    Allowed values
      searchSortUnspecified - 
      date - Resources are sorted in reverse chronological order based on the date they were created.
      rating - Resources are sorted from highest to lowest rating.
      viewCount - Resources are sorted from highest to lowest number of views.
      relevance - Resources are sorted based on their relevance to the search query. This is the default value for this parameter.
      title - Resources are sorted alphabetically by title.
      videoCount - Channels are sorted in descending order of their number of uploaded videos.
  pageToken: string, The *pageToken* parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken and prevPageToken properties identify other pages that could be retrieved.
  publishedAfter: string, Filter on resources published after this date.
  publishedBefore: string, Filter on resources published before this date.
  q: string, Textual search terms to match.
  regionCode: string, Display the content as seen by viewers in this country.
  relevanceLanguage: string, Return results relevant to this language.
  safeSearch: string, Indicates whether the search results should include restricted content as well as standard content.
    Allowed values
      safeSearchSettingUnspecified - 
      none - YouTube will not filter the search result set.
      moderate - YouTube will filter some content from search results and, at the least, will filter content that is restricted in your locale. Based on their content, search results could be removed from search results or demoted in search results. This is the default parameter value.
      strict - YouTube will try to exclude all restricted content from the search result set. Based on their content, search results could be removed from search results or demoted in search results.
  topicId: string, Restrict results to a particular topic.
  type: string, Restrict results to a particular set of resource types from One Platform. (repeated)
  videoCaption: string, Filter on the presence of captions on the videos.
    Allowed values
      videoCaptionUnspecified - 
      any - Do not filter results based on caption availability.
      closedCaption - Only include videos that have captions.
      none - Only include videos that do not have captions.
  videoCategoryId: string, Filter on videos in a specific category.
  videoDefinition: string, Filter on the definition of the videos.
    Allowed values
      any - Return all videos, regardless of their resolution.
      standard - Only retrieve videos in standard definition.
      high - Only retrieve HD videos.
  videoDimension: string, Filter on 3d videos.
    Allowed values
      any - Include both 3D and non-3D videos in returned results. This is the default value.
      2d - Restrict search results to exclude 3D videos.
      3d - Restrict search results to only include 3D videos.
  videoDuration: string, Filter on the duration of the videos.
    Allowed values
      videoDurationUnspecified - 
      any - Do not filter video search results based on their duration. This is the default value.
      short - Only include videos that are less than four minutes long.
      medium - Only include videos that are between four and 20 minutes long (inclusive).
      long - Only include videos longer than 20 minutes.
  videoEmbeddable: string, Filter on embeddable videos.
    Allowed values
      videoEmbeddableUnspecified - 
      any - Return all videos, embeddable or not.
      true - Only retrieve embeddable videos.
  videoLicense: string, Filter on the license of the videos.
    Allowed values
      any - Return all videos, regardless of which license they have, that match the query parameters.
      youtube - Only return videos that have the standard YouTube license.
      creativeCommon - Only return videos that have a Creative Commons license. Users can reuse videos with this license in other videos that they create. Learn more.
  videoPaidProductPlacement: string, A parameter
    Allowed values
      videoPaidProductPlacementUnspecified - 
      any - Return all videos, paid product placement or not.
      true - Restrict results to only videos with paid product placement.
  videoSyndicated: string, Filter on syndicated videos.
    Allowed values
      videoSyndicatedUnspecified - 
      any - Return all videos, syndicated or not.
      true - Only retrieve syndicated videos.
  videoType: string, Filter on videos of a specific type.
    Allowed values
      videoTypeUnspecified - 
      any - Return all videos.
      movie - Only retrieve movies.
      episode - Only retrieve episodes of shows.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    {
  "etag": "A String", # Etag of this resource.
  "eventId": "A String", # Serialized EventId of the request which produced this response.
  "items": [ # Pagination information for token pagination.
    { # A search result contains information about a YouTube video, channel, or playlist that matches the search parameters specified in an API request. While a search result points to a uniquely identifiable resource, like a video, it does not have its own persistent data.
      "etag": "A String", # Etag of this resource.
      "id": { # A resource id is a generic reference that points to another YouTube resource. # The id object contains information that can be used to uniquely identify the resource that matches the search request.
        "channelId": "A String", # The ID that YouTube uses to uniquely identify the referred resource, if that resource is a channel. This property is only present if the resourceId.kind value is youtube#channel.
        "kind": "A String", # The type of the API resource.
        "playlistId": "A String", # The ID that YouTube uses to uniquely identify the referred resource, if that resource is a playlist. This property is only present if the resourceId.kind value is youtube#playlist.
        "videoId": "A String", # The ID that YouTube uses to uniquely identify the referred resource, if that resource is a video. This property is only present if the resourceId.kind value is youtube#video.
      },
      "kind": "youtube#searchResult", # Identifies what kind of resource this is. Value: the fixed string "youtube#searchResult".
      "snippet": { # Basic details about a search result, including title, description and thumbnails of the item referenced by the search result. # The snippet object contains basic details about a search result, such as its title or description. For example, if the search result is a video, then the title will be the video's title and the description will be the video's description.
        "channelId": "A String", # The value that YouTube uses to uniquely identify the channel that published the resource that the search result identifies.
        "channelTitle": "A String", # The title of the channel that published the resource that the search result identifies.
        "description": "A String", # A description of the search result.
        "liveBroadcastContent": "A String", # It indicates if the resource (video or channel) has upcoming/active live broadcast content. Or it's "none" if there is not any upcoming/active live broadcasts.
        "publishedAt": "A String", # The creation date and time of the resource that the search result identifies.
        "thumbnails": { # Internal representation of thumbnails for a YouTube resource. # A map of thumbnail images associated with the search result. For each object in the map, the key is the name of the thumbnail image, and the value is an object that contains other information about the thumbnail.
          "default": { # A thumbnail is an image representing a YouTube resource. # The default image for this resource.
            "height": 42, # (Optional) Height of the thumbnail image.
            "url": "A String", # The thumbnail image's URL.
            "width": 42, # (Optional) Width of the thumbnail image.
          },
          "high": { # A thumbnail is an image representing a YouTube resource. # The high quality image for this resource.
            "height": 42, # (Optional) Height of the thumbnail image.
            "url": "A String", # The thumbnail image's URL.
            "width": 42, # (Optional) Width of the thumbnail image.
          },
          "maxres": { # A thumbnail is an image representing a YouTube resource. # The maximum resolution quality image for this resource.
            "height": 42, # (Optional) Height of the thumbnail image.
            "url": "A String", # The thumbnail image's URL.
            "width": 42, # (Optional) Width of the thumbnail image.
          },
          "medium": { # A thumbnail is an image representing a YouTube resource. # The medium quality image for this resource.
            "height": 42, # (Optional) Height of the thumbnail image.
            "url": "A String", # The thumbnail image's URL.
            "width": 42, # (Optional) Width of the thumbnail image.
          },
          "standard": { # A thumbnail is an image representing a YouTube resource. # The standard quality image for this resource.
            "height": 42, # (Optional) Height of the thumbnail image.
            "url": "A String", # The thumbnail image's URL.
            "width": 42, # (Optional) Width of the thumbnail image.
          },
        },
        "title": "A String", # The title of the search result.
      },
    },
  ],
  "kind": "youtube#searchListResponse", # Identifies what kind of resource this is. Value: the fixed string "youtube#searchListResponse".
  "nextPageToken": "A String", # The token that can be used as the value of the pageToken parameter to retrieve the next page in the result set.
  "pageInfo": { # Paging details for lists of resources, including total number of items available and number of resources returned in a single page. # General pagination information.
    "resultsPerPage": 42, # The number of results included in the API response.
    "totalResults": 42, # The total number of results in the result set.
  },
  "prevPageToken": "A String", # The token that can be used as the value of the pageToken parameter to retrieve the previous page in the result set.
  "regionCode": "A String",
  "tokenPagination": { # Stub token pagination template to suppress results.
  },
  "visitorId": "A String", # The visitorId identifies the visitor.
}
list_next()
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.