YouTube Content ID পরিষেবা

ইউটিউব কন্টেন্ট পার্টনারদের জন্য অ্যাসেট, ক্লেইম এবং ক্যাম্পেইন পরিচালনা করা।

ইউটিউব কন্টেন্ট আইডি পরিষেবা আপনাকে গুগল অ্যাপস স্ক্রিপ্টে ইউটিউব কন্টেন্ট আইডি এপিআই ব্যবহার করার সুযোগ দেয়। এই এপিআই ডেভেলপারদের ইউটিউবের কন্টেন্ট আইডি স্বত্ব ব্যবস্থাপনা সিস্টেমের সাথে সরাসরি যোগাযোগ করতে দেয়। একজন ইউটিউব পার্টনার হিসেবে, আপনি আপনার অ্যাসেট, ক্লেইম এবং ক্যাম্পেইন তৈরি ও পরিচালনা করতে এই এপিআই ব্যবহার করতে পারেন।

এটি একটি উন্নত পরিষেবা যা ব্যবহারের আগে সক্রিয় করতে হবে।

রেফারেন্স

এই পরিষেবা সম্পর্কে বিস্তারিত তথ্যের জন্য, পাবলিক ইউটিউব কন্টেন্ট আইডি এপিআই-এর রেফারেন্স ডকুমেন্টেশন দেখুন। অ্যাপস স্ক্রিপ্টের সমস্ত অ্যাডভান্সড পরিষেবার মতো, অ্যাডভান্সড ইউটিউব কন্টেন্ট আইডি পরিষেবাটিও পাবলিক এপিআই-এর মতোই একই অবজেক্ট, মেথড এবং প্যারামিটার ব্যবহার করে। আরও তথ্যের জন্য, ‘মেথড সিগনেচার কীভাবে নির্ধারণ করা হয় ’ দেখুন।

সমস্যা জানাতে এবং অন্যান্য সহায়তা পেতে, ইউটিউব এপিআই সাপোর্ট গাইড দেখুন।

নমুনা কোড

নিম্নলিখিত নমুনা কোডটি ইউটিউব কন্টেন্ট আইডি এপিআই-এর সংস্করণ ১ ব্যবহার করে।

আপনার ভিডিওটি দাবি করুন

এই ফাংশনটি নির্দিষ্ট অ্যাসেট এবং পলিসি নিয়মাবলী সহ আপনার ভিডিওতে একটি পার্টনার-আপলোডেড ক্লেইম তৈরি করে।

উন্নত/ইউটিউব কন্টেন্ট আইডি.জিএস
/**
 * 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
 */
function claimYourVideoWithMonetizePolicy() {
  // The ID of the content owner that you are acting on behalf of.
  const onBehalfOfContentOwner = "replaceWithYourContentOwnerID";
  // A YouTube video ID to claim. In this example, the video must be uploaded
  // to one of your onBehalfOfContentOwner's linked channels.
  const videoId = "replaceWithYourVideoID";
  const assetId = "replaceWithYourAssetID";
  const claimToInsert = {
    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/policies
    policy: { rules: [{ action: "monetize" }] },
  };
  try {
    const claimInserted = 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
 */
function updateAssetOwnership() {
  // The ID of the content owner that you are acting on behalf of.
  const onBehalfOfContentOwner = "replaceWithYourContentOwnerID";
  // Replace values with your asset id
  const assetId = "replaceWithYourAssetID";
  // The new ownership here would replace your existing ownership on the asset.
  const myAssetOwnership = {
    general: [
      {
        ratio: 100,
        owner: onBehalfOfContentOwner,
        type: "include",
        territories: ["US", "CA"],
      },
    ],
  };
  try {
    const updatedOwnership = 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
 */
function releaseClaim() {
  // The ID of the content owner that you are acting on behalf of.
  const onBehalfOfContentOwner = "replaceWithYourContentOwnerID";
  // The ID of the claim to be released.
  const claimId = "replaceWithYourClaimID";
  // To release the claim, change the resource's status to inactive.
  const claimToBeReleased = {
    status: "inactive",
  };
  try {
    const claimReleased = 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);
  }
}