我們正在更新 Data API,以符合 YouTube 計算 Shorts 觀看次數的方式。
瞭解詳情
ChannelSections
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
channelSection
資源包含一組
頻道獲選為精選的影片。例如,版面可以宣傳頻道的
最新上傳影片、最熱門的影片,或是一或多個播放清單中的影片。
一個頻道最多可以建立 10 個影片櫃。
方法
API 支援下列 channelSections
資源方法:
- list
- 傳回符合 API 要求條件的
channelSection
資源清單。
立即試用。
- 插入
- 將頻道版面加入已驗證使用者的頻道。一個頻道最多可以建立 10 個影片櫃。
立即試用。
- 更新
- 更新頻道版面。
立即試用。
- 刪除
- 刪除頻道版面。
立即試用。
屬性
下表定義了這個資源中顯示的屬性:
屬性 |
kind |
string
識別 API 資源的類型。值為 youtube#channelSection 。 |
etag |
etag
這項資源的 Etag。 |
id |
string
YouTube 用來識別頻道版面的 ID。 |
snippet |
object
snippet 物件包含頻道版面的基本詳細資料,例如類型和標題。 |
snippet.type |
string
頻道版面的類型。
這個屬性的有效值如下:
allPlaylists
completedEvents
liveEvents
multipleChannels
multiplePlaylists
popularUploads
recentUploads
singlePlaylist
subscriptions
upcomingEvents
|
snippet.channelId |
string
YouTube 用來識別發布頻道版面的頻道專屬 ID。 |
snippet.title |
string
版面標題。你只能將頻道版面的標題設為 snippet.type 或 multiplePlaylists 。事實上,當你插入或更新這幾類版面時,就必須指定標題。multipleChannels 如果為其他類型的頻道版面指定標題,系統會忽略該值。
這個屬性的長度上限為 100 個字元,而且可包含所有有效的 UTF-8 字元 (< 和 < 除外)。 |
snippet.position |
unsigned integer
版面在頻道頁面中的位置。此屬性使用從 0 開始的索引。0 值表示該頻道上出現的第一個區段,值為 1 代表第二個區段,依此類推。
如果在插入管道版面時沒有指定屬性值,則預設行為就是將新的區段顯示至最後。 |
contentDetails |
object
contentDetails 物件包含頻道版面內容的詳細資料,例如版面精選的播放清單或頻道清單。 |
contentDetails.playlists[] |
list
頻道版面中出現的一或多個播放清單 ID 清單。如果 channelSection 資源的 snippet.type 屬性為 singlePlaylist 或 multiplePlaylists ,您就必須指定播放清單 ID 清單,而且不應為其他版面類型指定這個屬性。如果類型為 singlePlaylist ,則這份清單只能指定一個播放清單 ID。 |
contentDetails.channels[] |
list
頻道版面中出現的一或多個頻道 ID 清單。如果 channelSection 資源的 snippet.type 屬性為 multipleChannels ,您就必須指定頻道 ID 清單,而且不得為其他區段指定這個屬性。您不能將自己的頻道加入清單中。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-21 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-21 (世界標準時間)。"],[[["\u003cp\u003eA \u003ccode\u003echannelSection\u003c/code\u003e resource contains information about a set of videos that a channel features, such as latest uploads, popular uploads, or playlists.\u003c/p\u003e\n"],["\u003cp\u003eChannels can manage their featured videos using the API, which allows creating, listing, updating, and deleting \u003ccode\u003echannelSection\u003c/code\u003e resources.\u003c/p\u003e\n"],["\u003cp\u003eA channel can have a maximum of 10 sections, each with a specified type like \u003ccode\u003esinglePlaylist\u003c/code\u003e, \u003ccode\u003emultipleChannels\u003c/code\u003e, or \u003ccode\u003epopularUploads\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEach \u003ccode\u003echannelSection\u003c/code\u003e has properties such as \u003ccode\u003ekind\u003c/code\u003e, \u003ccode\u003eetag\u003c/code\u003e, \u003ccode\u003eid\u003c/code\u003e, \u003ccode\u003esnippet\u003c/code\u003e, and \u003ccode\u003econtentDetails\u003c/code\u003e, which specify details about the section and its contents.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003econtentDetails\u003c/code\u003e property can contain a list of either playlists or channels featured in the section, depending on the \u003ccode\u003esnippet.type\u003c/code\u003e property.\u003c/p\u003e\n"]]],["Channel sections feature a curated set of videos, like latest or popular uploads, or playlists. API methods allow listing, inserting, updating, and deleting these sections. A channel can have up to 10 sections. Each section contains `snippet` and `contentDetails` objects which describes the type, title, position, and the featured channels/playlists. The type can be single or multiple playlists, or channels, amongst others. Specific titles are required for some types and cannot include \"\u003c\" or \"\u003e\".\n"],null,["# ChannelSections\n\nA **channelSection** resource contains information about a set of\nvideos that a channel has chosen to feature. For example, a section could feature a channel's\nlatest uploads, most popular uploads, or videos from one or more playlists. \n\n\nA channel can create a maximum of 10 shelves.\n\nMethods\n-------\n\nThe API supports the following methods for `channelSections` resources:\n\n[list](/youtube/v3/docs/channelSections/list)\n: Returns a list of `channelSection` resources that match the API request criteria.\n [Try it now](/youtube/v3/docs/channelSections/list#usage).\n\n[insert](/youtube/v3/docs/channelSections/insert)\n: Adds a channel section to the authenticated user's channel. A channel can create a maximum of 10 shelves.\n [Try it now](/youtube/v3/docs/channelSections/insert#usage).\n\n[update](/youtube/v3/docs/channelSections/update)\n: Updates a channel section.\n [Try it now](/youtube/v3/docs/channelSections/update#usage).\n\n[delete](/youtube/v3/docs/channelSections/delete)\n: Deletes a channel section.\n [Try it now](/youtube/v3/docs/channelSections/delete#usage).\n\nResource representation\n-----------------------\n\nThe following JSON structure shows the format of a `channelSections` resource: \n\n```carbon\n{\n \"#kind\": \"youtube#channelSection\",\n \"#etag\": etag,\n \"#id\": string,\n \"#snippet\": {\n \"#snippet.type\": string,\n \"#snippet.channelId\": string,\n \"#snippet.title\": string,\n \"#snippet.position\": unsigned integer\n },\n \"#contentDetails\": {\n \"#contentDetails.playlists[]\": [\n string\n ],\n \"#contentDetails.channels[]\": [\n string\n ]\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#channelSection`. |\n| `etag` | `etag` The Etag of this resource. |\n| `id` | `string` The ID that YouTube uses to uniquely identify the channel section. |\n| `snippet` | `object` The `snippet` object contains basic details about the channel section, such as its type and title. |\n| snippet.`type` | `string` The channel section's type. Valid values for this property are: - `allPlaylists` - `completedEvents` - `liveEvents` - `multipleChannels` - `multiplePlaylists` - `popularUploads` - `recentUploads` - `singlePlaylist` - `subscriptions` - `upcomingEvents` |\n| snippet.`channelId` | `string` The ID that YouTube uses to uniquely identify the channel that published the channel section. |\n| snippet.`title` | `string` The section's title. You can only set the title of a channel section that has a `snippet.type` value of either `multiplePlaylists` or `multipleChannels`, and, in fact, you must specify a title when inserting or updating either of those types of sections. If you specify a title for other types of channel sections, the value will be ignored. This property's value has a maximum length of 100 characters and may contain all valid UTF-8 characters except **\\\u003c** and **\\\u003e**. |\n| snippet.`position` | `unsigned integer` The section's position on the channel page. This property uses a 0-based index. A value of `0` identifies the first section that appears on the channel, a value of `1` identifies the second section, and so forth. If you do not specify a value for this property when inserting a channel section, the default behavior is to display the new section last. |\n| `contentDetails` | `object` The `contentDetails` object contains details about the channel section's content, such as a list of playlists or channels featured in the section. |\n| contentDetails.`playlists[]` | `list` A list of one or more playlist IDs that are featured in a channel section. You must specify a list of playlist IDs if the `channelSection` resource's `snippet.type` property is either `singlePlaylist` or `multiplePlaylists`, and this property should not be specified for other types of sections. If the type is `singlePlaylist`, this list must specify exactly one playlist ID. |\n| contentDetails.`channels[]` | `list` A list of one or more channel IDs that are featured in a channel section. You must specify a list of channel IDs if the `channelSection` resource's `snippet.type` property is `multipleChannels`, and this property should not be specified for other types of sections. You cannot include your own channel in the list. |"]]