YouTube API . subscriptions

Instance Methods

delete(id, onBehalfOfContentOwner=None)

Deletes subscriptions by IDs.

insert(part, body, onBehalfOfContentOwner=None)

Insert a subscription.

list(part, onBehalfOfContentOwner=None, id=None, pageToken=None, channelId=None, mine=None, maxResults=None, forChannelId=None, order=None)

Browses the subscriptions collection.

list_next(previous_request, previous_response)

Retrieves the next page of results.

Method Details

delete(id, onBehalfOfContentOwner=None)
Deletes subscriptions by IDs.

Args:
  id: string, YouTube IDs of the subscription to be deleted. (required)
  onBehalfOfContentOwner: string, The authenticated user acts on behalf of this content owner.
insert(part, body, onBehalfOfContentOwner=None)
Insert a subscription.

Args:
  part: string, One or more parts to return on the current request. (required)
  body: object, The request body. (required)
    The object takes the form of:

{ # A subscription resource contains information about a YouTube user subscription.
    "snippet": { # Basic details about a subscription, including title, description and thumbnails of the subscribed item. # Basic details about the subscription
      "description": "A String", # Description of the subscription.
      "title": "A String", # Title of the subscription.
      "resourceId": { # A resource id is a generic reference that points to another YouTube resource. # The resource subscribed to.
        "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".
      },
      "channelId": "A String", # Channel publishing the subscription.
      "publishedAt": "A String", # Date and time the subscription was published at.
      "thumbnails": { # Subscription thumbnails.
        "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.
        },
      },
    },
    "contentDetails": { # Details about the content to witch a subscription refers. # Basic statistics about the subscription
      "newItemCount": 42, # Number of new items in the subscription since its content was last read.
      "totalItemCount": 42, # Approximate total number of items the subscription points to.
    },
    "kind": "youtube#subscription", # The type of this API resource.
    "etag": "A String", # The eTag of the subscription.
    "id": "A String", # The unique id of the subscription.
  }

  onBehalfOfContentOwner: string, The authenticated user acts on behalf of this content owner.

Returns:
  An object of the form:

    { # A subscription resource contains information about a YouTube user subscription.
      "snippet": { # Basic details about a subscription, including title, description and thumbnails of the subscribed item. # Basic details about the subscription
        "description": "A String", # Description of the subscription.
        "title": "A String", # Title of the subscription.
        "resourceId": { # A resource id is a generic reference that points to another YouTube resource. # The resource subscribed to.
          "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".
        },
        "channelId": "A String", # Channel publishing the subscription.
        "publishedAt": "A String", # Date and time the subscription was published at.
        "thumbnails": { # Subscription thumbnails.
          "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.
          },
        },
      },
      "contentDetails": { # Details about the content to witch a subscription refers. # Basic statistics about the subscription
        "newItemCount": 42, # Number of new items in the subscription since its content was last read.
        "totalItemCount": 42, # Approximate total number of items the subscription points to.
      },
      "kind": "youtube#subscription", # The type of this API resource.
      "etag": "A String", # The eTag of the subscription.
      "id": "A String", # The unique id of the subscription.
    }
list(part, onBehalfOfContentOwner=None, id=None, pageToken=None, channelId=None, mine=None, maxResults=None, forChannelId=None, order=None)
Browses the subscriptions collection.

Args:
  part: string, Subscription parts to include in the returned response. Valid values are: id, snippet and contentDetails. (required)
  onBehalfOfContentOwner: string, The authenticated user acts on behalf of this content owner.
  id: string, YouTube IDs of the subscriptions to be returned.
  pageToken: string, Token for the page selection.
  channelId: string, Only return subscriptions to given channelId.
  mine: string, Flag indicating only return the subscriptions of the authenticated user.
  maxResults: integer, Maximum number of search results to return per page.
  forChannelId: string, Comma separated list of channel IDs to return subscriptions for.
  order: string, Sort order.
    Allowed values
      alphabetical - Sort alphabetically
      relevance - Sort by relevance.
      unread - Sort by order of activity.

Returns:
  An object of the form:

    { # A paginated list of subscriptions returned as the response to a youtube.subscriptions.list call.
    "nextPageToken": "A String", # Token to the next page.
    "kind": "youtube#subscriptionListResponse", # The type of this API response.
    "items": [ # List of subscriptions matching the request criteria.
      { # A subscription resource contains information about a YouTube user subscription.
          "snippet": { # Basic details about a subscription, including title, description and thumbnails of the subscribed item. # Basic details about the subscription
            "description": "A String", # Description of the subscription.
            "title": "A String", # Title of the subscription.
            "resourceId": { # A resource id is a generic reference that points to another YouTube resource. # The resource subscribed to.
              "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".
            },
            "channelId": "A String", # Channel publishing the subscription.
            "publishedAt": "A String", # Date and time the subscription was published at.
            "thumbnails": { # Subscription thumbnails.
              "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.
              },
            },
          },
          "contentDetails": { # Details about the content to witch a subscription refers. # Basic statistics about the subscription
            "newItemCount": 42, # Number of new items in the subscription since its content was last read.
            "totalItemCount": 42, # Approximate total number of items the subscription points to.
          },
          "kind": "youtube#subscription", # The type of this API resource.
          "etag": "A String", # The eTag of the subscription.
          "id": "A String", # The unique id of the subscription.
        },
    ],
    "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 list 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.