curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"mediaUrls": ["https://example.com/watermark.png"],
"timingType": "offsetFromStart",
"offsetMs": 15000,
"durationMs": 30000
}' \
-X POST https://api.ayrshare.com/api/post/youTubeWatermark
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post/youTubeWatermark", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
mediaUrls: ["https://example.com/watermark.png"],
timingType: "offsetFromStart",
offsetMs: 15000,
durationMs: 30000
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'mediaUrls': ['https://example.com/watermark.png'],
'timingType': 'offsetFromStart',
'offsetMs': 15000,
'durationMs': 30000
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'
}
r = requests.post('https://api.ayrshare.com/api/post/youTubeWatermark',
json=payload,
headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/post/youTubeWatermark';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$data = json_encode([
'mediaUrls' => ['https://example.com/watermark.png'],
'timingType' => 'offsetFromStart',
'offsetMs' => 15000,
'durationMs' => 30000
]);
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $data
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace SetYouTubeWatermark_csharp
{
class SetYouTubeWatermark
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post/youTubeWatermark";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = @"{
""mediaUrls"": [""https://example.com/watermark.png""],
""timingType"": ""offsetFromStart"",
""offsetMs"": 15000,
""durationMs"": 30000
}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"status": "success",
"message": "Watermark set successfully",
"mediaUrls": [
"https://example.com/watermark.png"
],
"timingType": "offsetFromStart",
"offsetMs": 1000,
"durationMs": 5000
}
{
"action": "post",
"status": "error",
"code": 140,
"message": "The image aspect ratio must be between 1 and 1. Current image aspect ratio: 1085/723 (1.50). https://www.ayrshare.com/docs/media-guidelines/youtube "
}
{
"status": "error",
"code": 307,
"message": "Media type 'image/webp' is not supported. "
}
{
"status": "error",
"code": 250,
"message": "The watermark cannot be set for this channel. Please check that you have proper permissions and the channel is valid."
}
YouTube
تعيين علامة مائية لـ YouTube
قم بتعيين علامة مائية على قناة YouTube الخاصة بك
POST
/
post
/
youTubeWatermark
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"mediaUrls": ["https://example.com/watermark.png"],
"timingType": "offsetFromStart",
"offsetMs": 15000,
"durationMs": 30000
}' \
-X POST https://api.ayrshare.com/api/post/youTubeWatermark
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post/youTubeWatermark", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
mediaUrls: ["https://example.com/watermark.png"],
timingType: "offsetFromStart",
offsetMs: 15000,
durationMs: 30000
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'mediaUrls': ['https://example.com/watermark.png'],
'timingType': 'offsetFromStart',
'offsetMs': 15000,
'durationMs': 30000
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'
}
r = requests.post('https://api.ayrshare.com/api/post/youTubeWatermark',
json=payload,
headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/post/youTubeWatermark';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$data = json_encode([
'mediaUrls' => ['https://example.com/watermark.png'],
'timingType' => 'offsetFromStart',
'offsetMs' => 15000,
'durationMs' => 30000
]);
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $data
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace SetYouTubeWatermark_csharp
{
class SetYouTubeWatermark
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post/youTubeWatermark";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = @"{
""mediaUrls"": [""https://example.com/watermark.png""],
""timingType"": ""offsetFromStart"",
""offsetMs"": 15000,
""durationMs"": 30000
}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"status": "success",
"message": "Watermark set successfully",
"mediaUrls": [
"https://example.com/watermark.png"
],
"timingType": "offsetFromStart",
"offsetMs": 1000,
"durationMs": 5000
}
{
"action": "post",
"status": "error",
"code": 140,
"message": "The image aspect ratio must be between 1 and 1. Current image aspect ratio: 1085/723 (1.50). https://www.ayrshare.com/docs/media-guidelines/youtube "
}
{
"status": "error",
"code": 307,
"message": "Media type 'image/webp' is not supported. "
}
{
"status": "error",
"code": 250,
"message": "The watermark cannot be set for this channel. Please check that you have proper permissions and the channel is valid."
}
قم بتعيين صورة علامة مائية على قناة YouTube الخاصة بك ستظهر على جميع مقاطع الفيديو الخاصة بك. يمكن تكوين العلامة المائية لتظهر في أوقات محدّدة أثناء تشغيل الفيديو.
- يتم تعيين الموضع تلقائيًا إلى الزاوية اليمنى السفلية (الإعداد الافتراضي لـ YouTube API)
- جميع معلمات التوقيت
timingTypeوoffsetMsوdurationMsمطلوبة عند تعيين علامة مائية - تنطبق العلامات المائية على جميع مقاطع الفيديو على القناة (الحالية والمستقبلية)
- يجب أن تلبّي صورة العلامة المائية إرشادات وسائط العلامة المائية الخاصة بـ YouTube
- يجب أن يكون لديك أذونات مناسبة لإدارة قناة YouTube
معلمات الرأس
معلمات الجسم
مصفوفة تحتوي على عنوان URL لصورة العلامة المائية. سيتم استخدام عنوان URL الأول فقط.
متى تعرض العلامة المائية أثناء تشغيل الفيديو.خيارات timingType المتاحة:
offsetFromStart- إظهار العلامة المائية بدءًا من وقت محدّد بعد بدء الفيديوoffsetFromEnd- إظهار العلامة المائية بدءًا من وقت محدّد قبل انتهاء الفيديو
إزاحة الوقت بالمللي ثانية. يجب أن يكون رقمًا موجبًا.
- لـ
offsetFromStart: الوقت بعد بدء الفيديو لإظهار العلامة المائية - لـ
offsetFromEnd: الوقت قبل انتهاء الفيديو لإظهار العلامة المائية
مدة عرض العلامة المائية بالمللي ثانية. يجب أن يكون رقمًا موجبًا.
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"mediaUrls": ["https://example.com/watermark.png"],
"timingType": "offsetFromStart",
"offsetMs": 15000,
"durationMs": 30000
}' \
-X POST https://api.ayrshare.com/api/post/youTubeWatermark
const API_KEY = "API_KEY";
fetch("https://api.ayrshare.com/api/post/youTubeWatermark", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
mediaUrls: ["https://example.com/watermark.png"],
timingType: "offsetFromStart",
offsetMs: 15000,
durationMs: 30000
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {
'mediaUrls': ['https://example.com/watermark.png'],
'timingType': 'offsetFromStart',
'offsetMs': 15000,
'durationMs': 30000
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'
}
r = requests.post('https://api.ayrshare.com/api/post/youTubeWatermark',
json=payload,
headers=headers)
print(r.json())
<?php
$apiUrl = 'https://api.ayrshare.com/api/post/youTubeWatermark';
$apiKey = 'API_KEY'; // Replace 'API_KEY' with your actual API key
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $apiKey,
];
$data = json_encode([
'mediaUrls' => ['https://example.com/watermark.png'],
'timingType' => 'offsetFromStart',
'offsetMs' => 15000,
'durationMs' => 30000
]);
$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $data
]);
$response = curl_exec($curl);
if ($response === false) {
echo 'Curl error: ' . curl_error($curl);
} else {
echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}
curl_close($curl);
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace SetYouTubeWatermark_csharp
{
class SetYouTubeWatermark
{
private static readonly HttpClient client = new HttpClient();
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://api.ayrshare.com/api/post/youTubeWatermark";
// Set up request headers
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
// Prepare JSON content
string json = @"{
""mediaUrls"": [""https://example.com/watermark.png""],
""timingType"": ""offsetFromStart"",
""offsetMs"": 15000,
""durationMs"": 30000
}";
var content = new StringContent(json, Encoding.UTF8, "application/json");
try
{
// Send POST request
HttpResponseMessage response = await client.PostAsync(url, content);
response.EnsureSuccessStatusCode();
// Read response
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
catch (HttpRequestException e)
{
Console.WriteLine($"Error: {e.Message}");
}
}
}
}
{
"status": "success",
"message": "Watermark set successfully",
"mediaUrls": [
"https://example.com/watermark.png"
],
"timingType": "offsetFromStart",
"offsetMs": 1000,
"durationMs": 5000
}
{
"action": "post",
"status": "error",
"code": 140,
"message": "The image aspect ratio must be between 1 and 1. Current image aspect ratio: 1085/723 (1.50). https://www.ayrshare.com/docs/media-guidelines/youtube "
}
{
"status": "error",
"code": 307,
"message": "Media type 'image/webp' is not supported. "
}
{
"status": "error",
"code": 250,
"message": "The watermark cannot be set for this channel. Please check that you have proper permissions and the channel is valid."
}
⌘I
