YouTube Content ID サービス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
YouTube Content ID サービスを使用すると、Apps Script で YouTube Content ID API を使用できます。この API を使用すると、YouTube の Content ID 権利管理システムと直接やり取りできます。YouTube パートナーは、API を使用してアセット、申し立て、キャンペーンを作成、管理できます。
リファレンス
このサービスの詳細については、公開されている YouTube Content ID API のリファレンス ドキュメントをご覧ください。Apps Script のすべての高度なサービスと同様に、高度な YouTube Content ID サービスでは、公開 API と同じオブジェクト、メソッド、パラメータを使用します。詳細については、メソッド シグネチャの決定方法をご覧ください。
問題を報告したり、その他のサポートを見つけたりするには、YouTube API サポートガイドをご覧ください。
サンプルコード
以下のサンプルコードでは、YouTube Content ID API のバージョン 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```"]]