บริการ Content ID ของ YouTube
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
บริการ Content ID ของ YouTube ช่วยให้คุณใช้ YouTube Content ID API ใน Apps Script ได้ API นี้ช่วยให้นักพัฒนาซอฟต์แวร์โต้ตอบกับระบบการจัดการสิทธิ์ของ Content ID ของ YouTube ได้โดยตรง
ในฐานะพาร์ทเนอร์ YouTube คุณสามารถใช้ API เพื่อสร้างและจัดการชิ้นงาน การอ้างสิทธิ์ และแคมเปญได้
ข้อมูลอ้างอิง
ดูข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ได้ที่เอกสารอ้างอิงสำหรับ Content ID API ของ YouTube แบบสาธารณะ เช่นเดียวกับ
บริการขั้นสูงทั้งหมดใน Apps Script บริการขั้นสูงของ YouTube Content ID จะใช้ออบเจ็กต์
เมธอด และพารามิเตอร์เดียวกันกับ API สาธารณะ ดูข้อมูลเพิ่มเติมได้ที่วิธีกำหนดลายเซ็นของเมธอด
หากต้องการรายงานปัญหาและรับการสนับสนุนอื่นๆ โปรดดูคู่มือการสนับสนุน YouTube API
โค้ดตัวอย่าง
ตัวอย่างโค้ดด้านล่างใช้ API สำหรับ Content ID ของ YouTube เวอร์ชัน 1
อ้างสิทธิ์ในวิดีโอ
ฟังก์ชันนี้จะสร้างการอ้างสิทธิ์โดยพาร์ทเนอร์ที่อัปโหลดในวิดีโอของคุณด้วยเนื้อหาและกฎนโยบายที่ระบุ
อัปเดตการเป็นเจ้าของเนื้อหา
ฟังก์ชันนี้จะอัปเดตการเป็นเจ้าของเนื้อหาที่มีอยู่
ถอนการอ้างสิทธิ์
ฟังก์ชันนี้จะยกเลิกการอ้างสิทธิ์ที่มีอยู่แล้วในวิดีโอ
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eThe YouTube Content ID API allows YouTube partners to manage their copyrighted content and rights through Apps Script.\u003c/p\u003e\n"],["\u003cp\u003eThis advanced service requires prior enabling and is exclusively available to YouTube content partners via the Google Developers Console.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use the API to automate tasks like claiming videos, updating asset ownership, and releasing claims, streamlining content management workflows.\u003c/p\u003e\n"],["\u003cp\u003eThe provided sample code demonstrates how to utilize the YouTube Content ID API for these tasks, offering practical examples for implementation.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the reference documentation and YouTube API support guide for detailed information and troubleshooting assistance.\u003c/p\u003e\n"]]],[],null,["# YouTube Content ID Service\n\nThe YouTube Content ID service allows you to use the\n[YouTube Content ID API](/youtube/partner) in Apps Script. This API lets developers interact\ndirectly with YouTube's Content ID rights management system.\nAs a YouTube partner, you can use the API to create and manage your assets, claims and campaigns.\n| **Warning:** The YouTube Content ID API is intended for use by YouTube content partners and is not accessible to all developers or to all YouTube users. If you do not see the YouTube Content ID API as one of the services listed in the [Google Developers Console](https://console.developers.google.com), you can consider joining the [YouTube Partner Program](https://support.google.com/youtube/answer/72851).\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n---------\n\nFor detailed information on this service, see the\n[reference documentation](/youtube/partner/docs/v1) for the public YouTube Content ID API. Like\nall advanced services in Apps Script, the advanced YouTube Content ID service uses the same objects,\nmethods, and parameters as the public API. For more information, see [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[YouTube API support guide](/youtube/v3/support).\n\nSample code\n-----------\n\nThe sample code below uses [version 1](/youtube/partner/docs/v1) of the YouTube Content ID API.\n\n### Claim your video\n\nThis function creates a partner-uploaded claim on your video with the specified asset and policy\nrules. \nadvanced/youtubeContentId.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/youtubeContentId.gs) \n\n```javascript\n/**\n * This function creates a partner-uploaded claim on a video with the specified\n * asset and policy rules.\n * @see https://developers.google.com/youtube/partner/docs/v1/claims/insert\n */\nfunction claimYourVideoWithMonetizePolicy() {\n // The ID of the content owner that you are acting on behalf of.\n const onBehalfOfContentOwner = 'replaceWithYourContentOwnerID';\n // A YouTube video ID to claim. In this example, the video must be uploaded\n // to one of your onBehalfOfContentOwner's linked channels.\n const videoId = 'replaceWithYourVideoID';\n const assetId = 'replaceWithYourAssetID';\n const claimToInsert = {\n 'videoId': videoId,\n 'assetId': assetId,\n 'contentType': 'audiovisual',\n // Set the claim policy to monetize. You can also specify a policy ID here\n // instead of policy rules.\n // For details, please refer to the YouTube Content ID API Policies\n // documentation:\n // https://developers.google.com/youtube/partner/docs/v1/policies\n 'policy': {'rules': [{'action': 'monetize'}]}\n };\n try {\n const claimInserted = YouTubeContentId.Claims.insert(claimToInsert,\n {'onBehalfOfContentOwner': onBehalfOfContentOwner});\n console.log('Claim created on video %s: %s', videoId, claimInserted);\n } catch (e) {\n console.log('Failed to create claim on video %s, error: %s',\n videoId, e.message);\n }\n}\n```\n\n### Update asset ownership\n\nThis function updates your ownership on an existing asset. \nadvanced/youtubeContentId.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/youtubeContentId.gs) \n\n```javascript\n/**\n * This function updates your onBehalfOfContentOwner's ownership on an existing\n * asset.\n * @see https://developers.google.com/youtube/partner/docs/v1/ownership/update\n */\nfunction updateAssetOwnership() {\n // The ID of the content owner that you are acting on behalf of.\n const onBehalfOfContentOwner = 'replaceWithYourContentOwnerID';\n // Replace values with your asset id\n const assetId = 'replaceWithYourAssetID';\n // The new ownership here would replace your existing ownership on the asset.\n const myAssetOwnership = {\n 'general': [\n {\n 'ratio': 100,\n 'owner': onBehalfOfContentOwner,\n 'type': 'include',\n 'territories': [\n 'US',\n 'CA'\n ]\n }\n ]\n };\n try {\n const updatedOwnership = YouTubeContentId.Ownership.update(myAssetOwnership,\n assetId, {'onBehalfOfContentOwner': onBehalfOfContentOwner});\n console.log('Ownership updated on asset %s: %s', assetId, updatedOwnership);\n } catch (e) {\n console.log('Ownership update failed on asset %s, error: %s',\n assetId, e.message);\n }\n}\n```\n\n### Release a claim\n\nThis function releases an existing claim you have on a video. \nadvanced/youtubeContentId.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/youtubeContentId.gs) \n\n```javascript\n/**\n * This function releases an existing claim your onBehalfOfContentOwner has\n * on a video.\n * @see https://developers.google.com/youtube/partner/docs/v1/claims/patch\n */\nfunction releaseClaim() {\n // The ID of the content owner that you are acting on behalf of.\n const onBehalfOfContentOwner = 'replaceWithYourContentOwnerID';\n // The ID of the claim to be released.\n const claimId = 'replaceWithYourClaimID';\n // To release the claim, change the resource's status to inactive.\n const claimToBeReleased = {\n 'status': 'inactive'\n };\n try {\n const claimReleased = YouTubeContentId.Claims.patch(claimToBeReleased,\n claimId, {'onBehalfOfContentOwner': onBehalfOfContentOwner});\n console.log('Claim %s was released: %s', claimId, claimReleased);\n } catch (e) {\n console.log('Failed to release claim %s, error: %s', claimId, e.message);\n }\n}\n```"]]