# YouTube Data API . comments

## Instance Methods

Deletes a comment.

Creates a new comment.

Returns a list of comments that match the API request parameters.

Retrieves the next page of results.

Expresses the caller's opinion that a comment is spam.

Sets the moderation status of one or more comments.

Modifies an existing comment.

### Method Details

`delete(id)`

    Deletes a comment.

    Args:
      id: string, The id parameter specifies the comment ID for the resource that should be deleted. (required)

`insert(part=None, body)`

    Creates a new comment.

    Note: to create a top level comment it is also necessary to create a comment thread. Both are accomplished through the commentThreads resource.

    Args:
      part: string, The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include.

    The part names that you can include in the parameter value are id and snippet. However only snippet contains properties that can be set. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A comment represents a single YouTube comment.
      "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
        "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
        "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
        "authorDisplayName": "A String", # The name of the user who posted the comment.
        "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
        "videoId": "A String", # The ID of the video the comment refers to, if any.
        "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
        "likeCount": 42, # The total number of likes this comment has received.
        "authorChannelId": { # The id of the author's YouTube channel, if any.
          "value": "A String",
        },
        "parentId": "A String", # The unique id of the parent comment, only set for replies.
        "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
        "canRate": True or False, # Whether the current viewer can rate this comment.
        "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
        "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
        "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
        "authorGoogleplusProfileUrl": "A String", # Link to the author's Google+ profile, if any.
        "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
      },
      "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
      "etag": "A String", # Etag of this resource.
      "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
    }

    Returns:
      An object of the form:

        { # A comment represents a single YouTube comment.
        "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
          "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
          "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
          "authorDisplayName": "A String", # The name of the user who posted the comment.
          "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
          "videoId": "A String", # The ID of the video the comment refers to, if any.
          "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
          "likeCount": 42, # The total number of likes this comment has received.
          "authorChannelId": { # The id of the author's YouTube channel, if any.
            "value": "A String",
          },
          "parentId": "A String", # The unique id of the parent comment, only set for replies.
          "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
          "canRate": True or False, # Whether the current viewer can rate this comment.
          "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
          "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
          "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
          "authorGoogleplusProfileUrl": "A String", # Link to the author's Google+ profile, if any.
          "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
        },
        "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
        "etag": "A String", # Etag of this resource.
        "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
      }

`list(part, pageToken=None, maxResults=None, id=None, parentId=None, textFormat=None)`

    Returns a list of comments that match the API request parameters.

    Args:
      part: string, The part parameter specifies the comment resource parts that the API response will include. Supported values are id and snippet. (required)
      pageToken: string, The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved.

    Note: This parameter is not supported for use in conjunction with the id parameter.
      maxResults: integer, The maxResults parameter specifies the maximum number of items that should be returned in the result set.

    Note: This parameter is not supported for use in conjunction with the id parameter.
      id: string, The id parameter specifies a comma-separated list of comment IDs for the resources that should be retrieved.
      parentId: string, The parentId parameter specifies the ID of the comment for which replies should be retrieved.

    Note: Currently YouTube features only one level of replies (ie replies to top level comments). However replies to replies may be supported in the future.
      textFormat: string, Set this parameter's value to html or plainText to instruct the API to return the comments left by users formatted as HTML or as plain text.
        Allowed values
          html - Returns the comments in HTML format.
          plainText - Returns the comments in plain text format.

    Returns:
      An object of the form:

        {
        "eventId": "A String", # Serialized EventId of the request which produced this response.
        "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.
        "kind": "youtube#commentListResponse", # Identifies what kind of resource this is. Value: the fixed string "youtube#commentListResponse".
        "visitorId": "A String", # The visitorId identifies the visitor.
        "items": [ # A list of comments that match the request criteria.
          { # A comment represents a single YouTube comment.
            "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
              "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
              "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
              "authorDisplayName": "A String", # The name of the user who posted the comment.
              "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
              "videoId": "A String", # The ID of the video the comment refers to, if any.
              "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
              "likeCount": 42, # The total number of likes this comment has received.
              "authorChannelId": { # The id of the author's YouTube channel, if any.
                "value": "A String",
              },
              "parentId": "A String", # The unique id of the parent comment, only set for replies.
              "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
              "canRate": True or False, # Whether the current viewer can rate this comment.
              "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
              "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
              "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
              "authorGoogleplusProfileUrl": "A String", # Link to the author's Google+ profile, if any.
              "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
            },
            "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
            "etag": "A String", # Etag of this resource.
            "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
          },
        ],
        "tokenPagination": { # Stub token pagination template to suppress results.
        },
        "etag": "A String", # Etag of this resource.
        "pageInfo": { # Paging details for lists of resources, including total number of items available and number of resources returned in a single page.
          "totalResults": 42, # The total number of results in the result set.
          "resultsPerPage": 42, # The number of results included in the API response.
        },
      }

`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.

`markAsSpam(id)`

    Expresses the caller's opinion that a comment is spam.

    Args:
      id: string, The id parameter specifies a comma-separated list of IDs of comments which should get flagged as spam. (required)

`setModerationStatus(id, moderationStatus, banAuthor=None)`

    Sets the moderation status of one or more comments.

    Args:
      id: string, The id parameter specifies a comma-separated list of IDs of comments whose moderation status should be updated. (required)
      moderationStatus: string, Determines the new moderation status of the specified comments. (required)
        Allowed values
          heldForReview - Marks a comment as awaiting review by a moderator.
          published - Clears a comment for public display.
          rejected - Rejects a comment as not fit for display.

    Note: currently there is no way to list or otherwise discover a rejected comment. However it is possible to change its moderation status as long as its ID is still known.

    Note: Currently, if you reject a comment you effectively also hide all its replies as there is no longer any way to discover them. This may change in the future.
      banAuthor: boolean, The banAuthor paramter, if set to true, adds the author of the comment to the ban list. This means all future comments of the author will autmomatically be rejected.

    Note: This parameter is only valid in combination with moderationStatus 'rejected'.

`update(part=None, body)`

    Modifies an existing comment.

    Args:
      part: string, The part parameter serves two purposes in this operation. It identifies the properties that the write operation will set as well as the properties that the API response will include.

    The part names that you can include in the parameter value are id and snippet. However only snippet contains properties that can be updated. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A comment represents a single YouTube comment.
      "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
        "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
        "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
        "authorDisplayName": "A String", # The name of the user who posted the comment.
        "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
        "videoId": "A String", # The ID of the video the comment refers to, if any.
        "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
        "likeCount": 42, # The total number of likes this comment has received.
        "authorChannelId": { # The id of the author's YouTube channel, if any.
          "value": "A String",
        },
        "parentId": "A String", # The unique id of the parent comment, only set for replies.
        "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
        "canRate": True or False, # Whether the current viewer can rate this comment.
        "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
        "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
        "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
        "authorGoogleplusProfileUrl": "A String", # Link to the author's Google+ profile, if any.
        "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
      },
      "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
      "etag": "A String", # Etag of this resource.
      "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
    }

    Returns:
      An object of the form:

        { # A comment represents a single YouTube comment.
        "snippet": { # Basic details about a comment, such as its author and text. # The snippet object contains basic details about the comment.
          "authorChannelUrl": "A String", # Link to the author's YouTube channel, if any.
          "viewerRating": "A String", # The rating the viewer has given to this comment. For the time being this will never return RATE_TYPE_DISLIKE and instead return RATE_TYPE_NONE. This may change in the future.
          "authorDisplayName": "A String", # The name of the user who posted the comment.
          "channelId": "A String", # The id of the corresponding YouTube channel. In case of a channel comment this is the channel the comment refers to. In case of a video comment it's the video's channel.
          "videoId": "A String", # The ID of the video the comment refers to, if any.
          "moderationStatus": "A String", # The comment's moderation status. Will not be set if the comments were requested through the id filter.
          "likeCount": 42, # The total number of likes this comment has received.
          "authorChannelId": { # The id of the author's YouTube channel, if any.
            "value": "A String",
          },
          "parentId": "A String", # The unique id of the parent comment, only set for replies.
          "publishedAt": "A String", # The date and time when the comment was orignally published. The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
          "canRate": True or False, # Whether the current viewer can rate this comment.
          "textOriginal": "A String", # The comment's original raw text as initially posted or last updated. The original text will only be returned if it is accessible to the viewer, which is only guaranteed if the viewer is the comment's author.
          "updatedAt": "A String", # The date and time when was last updated . The value is specified in ISO 8601 (YYYY-MM-DDThh:mm:ss.sZ) format.
          "authorProfileImageUrl": "A String", # The URL for the avatar of the user who posted the comment.
          "authorGoogleplusProfileUrl": "A String", # Link to the author's Google+ profile, if any.
          "textDisplay": "A String", # The comment's text. The format is either plain text or HTML dependent on what has been requested. Even the plain text representation may differ from the text originally posted in that it may replace video links with video titles etc.
        },
        "kind": "youtube#comment", # Identifies what kind of resource this is. Value: the fixed string "youtube#comment".
        "etag": "A String", # Etag of this resource.
        "id": "A String", # The ID that YouTube uses to uniquely identify the comment.
      }