אנחנו מעדכנים את Data API כך שיתאים לאופן שבו YouTube סופר צפיות ב-Shorts.
מידע נוסף
Comments: list
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מחזירה רשימה של תגובות שתואמות לפרמטרים של בקשת ה-API.
ההשפעה של המכסה: לקריאה לשיטה הזו יש עלות מכסה של יחידה אחת.
תרחישים נפוצים לדוגמה
בקשה
בקשת HTTP
GET https://www.googleapis.com/youtube/v3/comments
פרמטרים
בטבלה הבאה מפורטים הפרמטרים שהשאילתה הזו תומכת בהם. כל הפרמטרים המפורטים הם פרמטרים של שאילתות.
פרמטרים |
הפרמטרים הנדרשים |
part |
string
הפרמטר part מציין רשימה מופרדת בפסיקים של מאפיין משאב comment אחד או יותר שייכללו בתגובת ה-API.
הרשימה הבאה מכילה את שמות part שאפשר לכלול בערך הפרמטר:
|
מסננים (יש לציין בדיוק אחד מהפרמטרים הבאים) |
id |
string
הפרמטר id מציין רשימה של מזהי תגובות שמופרדים בפסיקים עבור המשאבים שמאוחזרים. במשאב comment , המאפיין id מציין את מזהה התגובה. |
parentId |
string
הפרמטר parentId מציין את המזהה של התגובה שאת התשובות שלה צריך לאחזר.
הערה: בשלב זה, מערכת YouTube תומכת בתשובות רק לתגובות ברמה העליונה. עם זאת, יכול להיות שבהמשך תהיה תמיכה בתשובות לתשובות. |
פרמטרים אופציונליים |
maxResults |
unsigned integer
הפרמטר maxResults מציין את מספר הפריטים המקסימלי שצריך להחזיר בקבוצת התוצאות.
הערה: הפרמטר הזה לא נתמך לשימוש בשילוב עם הפרמטר id . הערכים הקבילים הם 1 עד 100 , כולל. ערך ברירת המחדל הוא 20 . |
pageToken |
string
הפרמטר pageToken מזהה דף ספציפי בקבוצת התוצאות שצריך להחזיר. בתגובת API, המאפיין nextPageToken מזהה את הדף הבא בתוצאה שניתן לאחזר.
הערה: לא ניתן להשתמש בפרמטר הזה בשילוב עם הפרמטר id . |
textFormat |
string
הפרמטר הזה מציין אם ה-API צריך להחזיר תגובות בפורמט HTML או כטקסט פשוט. ערך ברירת המחדל הוא html .
הערכים הקבילים הם:
html – הצגת התגובות בפורמט HTML. זהו ערך ברירת המחדל.
plainText – החזרת התגובות בפורמט טקסט פשוט.
|
גוף הבקשה
אין לציין את גוף הבקשה בקריאה לשיטה הזו.
תשובה
אם הפעולה בוצעה בהצלחה, השיטה הזו מחזירה גוף תגובה עם המבנה הבא:
{
"kind": "youtube#commentListResponse",
"etag": etag,
"nextPageToken": string,
"pageInfo": {
"totalResults": integer,
"resultsPerPage": integer
},
"items": [
comment Resource
]
}
תכונות
הטבלה הבאה מגדירה את המאפיינים שיופיעו במשאב הזה:
תכונות |
kind |
string
מזהה את הסוג של משאב ה-API. הערך יהיה youtube#commentListResponse . |
etag |
etag
ה-e של המשאב הזה. |
nextPageToken |
string
האסימון שיכול לשמש כערך של הפרמטר pageToken כדי לאחזר את הדף הבא בקבוצת התוצאות. |
pageInfo |
object
האובייקט pageInfo כולל את פרטי החלוקה לדפים של קבוצת התוצאות. |
pageInfo.totalResults |
integer
המספר הכולל של התוצאות בקבוצת התוצאות. |
pageInfo.resultsPerPage |
integer
מספר התוצאות שכלולות בתגובת ה-API. |
items[] |
list
רשימה של תגובות שתואמות לקריטריונים של הבקשה. |
שגיאות
בטבלה הבאה מפורטות הודעות השגיאה שה-API עלול להחזיר בתגובה לקריאה לשיטה הזו. פרטים נוספים זמינים במסמכים בנושא הודעת שגיאה.
סוג השגיאה |
פרטי השגיאה |
תיאור |
רוצה לנסות?
משתמשים ב-APIs Explorer כדי לקרוא ל-API הזה ולראות את הבקשה והתגובה של ה-API.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-04-26 (שעון UTC).
[null,null,["עדכון אחרון: 2024-04-26 (שעון UTC)."],[],[],null,["# Comments: list\n\nReturns a list of comments that match the API request parameters.\n\n**Quota impact:** A call to this method has a [quota cost](/youtube/v3/getting-started#quota) of 1 unit.\n\nCommon use cases\n----------------\n\nThe list below shows common use cases for this method. Hover over a use case to see its description, or click on a use case to load sample parameter values in the APIs Explorer. You can open the [fullscreen APIs Explorer](#) to see code samples that dynamically update to reflect the parameter values entered in the Explorer.\n\nThe table below shows common use cases for this method. You can click on a use case name to load sample parameter values in the APIs Explorer. Or you can see code samples for a use case in the fullscreen APIs Explorer by clicking on the code icon below a use case name. In the fullscreen UI, you can update parameter and property values and the code samples will dynamically update to reflect the values you enter. \nThis method has one common use case, which is described below. The buttons below the description populate the APIs Explorer with sample values or open the fullscreen APIs Explorer to show code samples that use those values. The code samples also dynamically update if you change the values.\n\n\u003cbr /\u003e\n\nRequest\n-------\n\n### HTTP request\n\n```\nGET https://www.googleapis.com/youtube/v3/comments\n```\n\n### Parameters\n\nThe following table lists the parameters that this query supports. All of the parameters listed are query parameters.\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| **Required parameters** |||\n| `part` | `string` The **part** parameter specifies a comma-separated list of one or more `comment` resource properties that the API response will include. The following list contains the `part` names that you can include in the parameter value: - `id` - `snippet` |\n| **Filters (specify exactly one of the following parameters)** |||\n| `id` | `string` The **id** parameter specifies a comma-separated list of comment IDs for the resources that are being retrieved. In a `comment` resource, the `id` property specifies the comment's ID. |\n| `parentId` | `string` The **parentId** parameter specifies the ID of the comment for which replies should be retrieved. **Note:** YouTube currently supports replies only for top-level comments. However, replies to replies may be supported in the future. |\n| **Optional parameters** |||\n| `maxResults` | `unsigned 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](#id) parameter. Acceptable values are `1` to `100`, inclusive. The default value is `20`. |\n| `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](#id) parameter. |\n| `textFormat` | `string` This parameter indicates whether the API should return comments formatted as HTML or as plain text. The default value is `html`. Acceptable values are: - **html** -- Returns the comments in HTML format. This is the default value. - **plainText** -- Returns the comments in plain text format. |\n\n### Request body\n\nDo not provide a request body when calling this method.\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure: \n\n```objective-c\n{\n \"kind\": \"youtube#commentListResponse\",\n \"etag\": etag,\n \"nextPageToken\": string,\n \"pageInfo\": {\n \"totalResults\": integer,\n \"resultsPerPage\": integer\n },\n \"items\": [\n comment Resource\n ]\n}\n```\n\n### Properties\n\nThe following table defines the properties that appear in this resource:\n\n| Properties ||\n|---------------------------|----------------------------------------------------------------------------------------------------------------------------|\n| `kind` | `string` Identifies the API resource's type. The value will be `youtube#commentListResponse`. |\n| `etag` | `etag` The Etag of this resource. |\n| `nextPageToken` | `string` The token that can be used as the value of the `pageToken` parameter to retrieve the next page in the result set. |\n| `pageInfo` | `object` The `pageInfo` object encapsulates paging information for the result set. |\n| pageInfo.`totalResults` | `integer` The total number of results in the result set. |\n| pageInfo.`resultsPerPage` | `integer` The number of results included in the API response. |\n| `items[]` | `list` A list of comments that match the request criteria. |\n\nErrors\n------\n\nThe following table identifies error messages that the API could return in response to a call to this method. Please see the [error message](/youtube/v3/docs/errors) documentation for more detail.\n\n| Error type | Error detail | Description |\n|--------------------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `badRequest (400)` | `operationNotSupported` | The id filter is only compatible with comments based on Google+. |\n| `forbidden (403)` | `forbidden` | One or more of the requested comments cannot be retrieved due to insufficient permissions. The request might not be properly authorized. |\n| `notFound (404)` | `commentNotFound` | One or more of the specified comments cannot be found. Check the values of the request's [id](/youtube/v3/docs/comments/list#id) and [parentId](/youtube/v3/docs/comments/list#parentId) parameters to ensure that they are correct. |\n\nTry it!\n-------\n\nUse the APIs Explorer to call this API and see the API request and response."]]