บริการ Content ID ของ YouTube
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
บริการ Content ID ของ YouTube ช่วยให้คุณใช้ API สำหรับ Content ID ของ YouTube ใน Apps Script ได้ API นี้ช่วยให้นักพัฒนาซอฟต์แวร์โต้ตอบ
กับระบบการจัดการสิทธิ์ของ Content ID ของ YouTube ได้โดยตรง
ในฐานะพาร์ทเนอร์ YouTube คุณสามารถใช้ API เพื่อสร้างและจัดการชิ้นงาน การอ้างสิทธิ์ และแคมเปญได้
ข้อมูลอ้างอิง
ดูข้อมูลโดยละเอียดเกี่ยวกับบริการนี้ได้ที่เอกสารอ้างอิงสำหรับ YouTube Content ID API สาธารณะ เช่นเดียวกับ
บริการขั้นสูงทั้งหมดใน Apps Script บริการขั้นสูงของ YouTube Content ID จะใช้ออบเจ็กต์
เมธอด และพารามิเตอร์เดียวกันกับ API สาธารณะ ดูข้อมูลเพิ่มเติมได้ที่วิธีกำหนดลายเซ็นของเมธอด
/** * This function creates a partner-uploaded claim on a video with the specified * asset and policy rules. * @see https://developers.google.com/youtube/partner/docs/v1/claims/insert */functionclaimYourVideoWithMonetizePolicy(){// The ID of the content owner that you are acting on behalf of.constonBehalfOfContentOwner="replaceWithYourContentOwnerID";// A YouTube video ID to claim. In this example, the video must be uploaded// to one of your onBehalfOfContentOwner's linked channels.constvideoId="replaceWithYourVideoID";constassetId="replaceWithYourAssetID";constclaimToInsert={videoId:videoId,assetId:assetId,contentType:"audiovisual",// Set the claim policy to monetize. You can also specify a policy ID here// instead of policy rules.// For details, please refer to the YouTube Content ID API Policies// documentation:// https://developers.google.com/youtube/partner/docs/v1/policiespolicy:{rules:[{action:"monetize"}]},};try{constclaimInserted=YouTubeContentId.Claims.insert(claimToInsert,{onBehalfOfContentOwner:onBehalfOfContentOwner,});console.log("Claim created on video %s: %s",videoId,claimInserted);}catch(e){console.log("Failed to create claim on video %s, error: %s",videoId,e.message,);}}
/** * This function updates your onBehalfOfContentOwner's ownership on an existing * asset. * @see https://developers.google.com/youtube/partner/docs/v1/ownership/update */functionupdateAssetOwnership(){// The ID of the content owner that you are acting on behalf of.constonBehalfOfContentOwner="replaceWithYourContentOwnerID";// Replace values with your asset idconstassetId="replaceWithYourAssetID";// The new ownership here would replace your existing ownership on the asset.constmyAssetOwnership={general:[{ratio:100,owner:onBehalfOfContentOwner,type:"include",territories:["US","CA"],},],};try{constupdatedOwnership=YouTubeContentId.Ownership.update(myAssetOwnership,assetId,{onBehalfOfContentOwner:onBehalfOfContentOwner},);console.log("Ownership updated on asset %s: %s",assetId,updatedOwnership);}catch(e){console.log("Ownership update failed on asset %s, error: %s",assetId,e.message,);}}
/** * This function releases an existing claim your onBehalfOfContentOwner has * on a video. * @see https://developers.google.com/youtube/partner/docs/v1/claims/patch */functionreleaseClaim(){// The ID of the content owner that you are acting on behalf of.constonBehalfOfContentOwner="replaceWithYourContentOwnerID";// The ID of the claim to be released.constclaimId="replaceWithYourClaimID";// To release the claim, change the resource's status to inactive.constclaimToBeReleased={status:"inactive",};try{constclaimReleased=YouTubeContentId.Claims.patch(claimToBeReleased,claimId,{onBehalfOfContentOwner:onBehalfOfContentOwner},);console.log("Claim %s was released: %s",claimId,claimReleased);}catch(e){console.log("Failed to release claim %s, error: %s",claimId,e.message);}}