このエンドポイントが役立つこと
レスポンスは、利用可能な 投稿 のフィールドを、正規化された V2 形式またはプラットフォーム固有の V1 形式で提供します。
使用に適した場面
オブジェクトが既にわかっていて、製品でその現在の公開コンテキストが必要な場合に「投稿 ID による詳細」を使用します。
まず結果と一般的なワークフローを確認し、次にパラメーターと動作するリクエスト例に進んでください。
レスポンスは、利用可能な 投稿 のフィールドを、正規化された V2 形式またはプラットフォーム固有の V1 形式で提供します。
オブジェクトが既にわかっていて、製品でその現在の公開コンテキストが必要な場合に「投稿 ID による詳細」を使用します。
製品の既知のオブジェクトを YouTube の公開フィールドで補完します。
後続の処理の前に、識別子と現在の公開コンテキストを確認します。
オブジェクトの詳細をレポート、評価、関連リクエストの入力として使用します。
どちらのバージョンも同じタスクを解決し、同じパラメーターを受け付けます。切り替えを使ってレスポンス構造を比較し、クライアントが想定するバージョンを選んでください。
このページでバージョンを切り替えると、同じドキュメント URL でレスポンス構造を比較できます。
認証、必須パラメーター、リクエストの形は V1 と V2 で同じです。実際には、エンドポイントのパスを組み立てるときとレスポンスを読み取るときにバージョンを選びます。
主な違いはレスポンスのエンベロープです。新しい連携では V2 を使用し、既存のクライアント契約との互換性が必要な場合にのみ V1 を残してください。
どちらのバージョンでも、同じ API キーのヘッダーと同じクエリパラメーターを使用します。このドキュメントでは、まず共通のパラメーターを示し、次に各バージョンのパスとコードスニペットを示します。
| パラメーター | 必須 | 型 | 例 | 説明 |
|---|---|---|---|---|
post_id |
はい | str |
Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok |
選択したプラットフォームにおける投稿の ID。 |
エンドポイントの正確なパス、URL の例、コードスニペットをコピーするときにバージョンを選んでください。上のパラメーター一覧は変わりません。
GET /api/v2/youtube.com/posts/details-by-post-idcurl --request GET \
--url "https://www.scrapestorm.net/api/v2/youtube.com/posts/details-by-post-id" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'post_id=Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v2/youtube.com/posts/details-by-post-id"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"post_id": "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
}
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v2/youtube.com/posts/details-by-post-id";
const params = new URLSearchParams({
post_id: "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
});
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
post_id: "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
};
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"post_id" => "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
];
try {
$response = $client->request("GET", "/api/v2/youtube.com/posts/details-by-post-id", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v2/youtube.com/posts/details-by-post-id"
params := url.Values{}
params.Set("post_id", "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
エンドポイントの正確なパス、URL の例、コードスニペットをコピーするときにバージョンを選んでください。上のパラメーター一覧は変わりません。
GET /api/v1/youtube.com/posts/details-by-post-idcurl --request GET \
--url "https://www.scrapestorm.net/api/v1/youtube.com/posts/details-by-post-id" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'post_id=Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v1/youtube.com/posts/details-by-post-id"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"post_id": "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
}
with requests.Session() as session:
response = session.request(
method="GET",
url=urljoin(BASE_URL, ENDPOINT),
headers=HEADERS,
params=params,
timeout=30,
)
response.raise_for_status()
payload = response.json()
print(payload)
const BASE_URL = "https://www.scrapestorm.net";
const endpoint = "/api/v1/youtube.com/posts/details-by-post-id";
const params = new URLSearchParams({
post_id: "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
});
const response = await fetch(`${BASE_URL}${endpoint}?${params.toString()}`, {
method: "GET",
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status} ${response.statusText}`);
}
const payload = await response.json();
console.log(payload);
import axios from "axios";
const client = axios.create({
baseURL: "https://www.scrapestorm.net",
timeout: 30000,
headers: {
Accept: "application/json",
"X-API-Key": "00000000-0000-4000-8000-000000000000",
},
});
const params = {
post_id: "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
};
const { data: payload } = await client.request({
method: "GET",
url: endpoint,
params,
});
console.log(payload);
<?php
declare(strict_types=1);
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
$client = new Client([
'base_uri' => "https://www.scrapestorm.net",
'timeout' => 30.0,
'headers' => [
'Accept' => 'application/json',
'X-API-Key' => "00000000-0000-4000-8000-000000000000",
],
]);
$query = [
"post_id" => "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
];
try {
$response = $client->request("GET", "/api/v1/youtube.com/posts/details-by-post-id", [
'query' => $query,
]);
$payload = json_decode(
(string) $response->getBody(),
true,
512,
JSON_THROW_ON_ERROR
);
var_dump($payload);
} catch (GuzzleException $e) {
throw $e;
}
package main
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"time"
)
func main() {
baseURL := "https://www.scrapestorm.net"
endpoint := "/api/v1/youtube.com/posts/details-by-post-id"
params := url.Values{}
params.Set("post_id", "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok")
req, err := http.NewRequest(
"GET",
fmt.Sprintf("%s%s?%s", baseURL, endpoint, params.Encode()),
nil,
)
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("X-API-Key", "00000000-0000-4000-8000-000000000000")
client := &http.Client{Timeout: 30 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var payload any
if err := json.NewDecoder(resp.Body).Decode(&payload); err != nil {
panic(err)
}
fmt.Printf("%+v\n", payload)
}
プレビューには主要なフィールドとコレクションの最初の要素が含まれているため、レスポンスの形をすばやく確認できます。バージョンを切り替えると JSON の形式が変わります。
このコンパクトな JSON の例は、V2 の直近の成功した検証実行から取得したものです。
{
"success": true,
"status": "ok",
"search_context": {
"post_id": "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok"
},
"data": {
"post": {
"author": {
"url": "https://www.youtube.com/@mkbhd",
"channel_id": "UCBJycsmduvYEL83R_U4JriQ",
"username": "mkbhd",
"display_name": "Marques Brownlee",
"avatar_url": "https://example.com/image.jpg",
"avatar_urls": "https://example.com/image.jpg"
},
"url": "https://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
"post_id": "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
"text": "Introducing a new colorway and updated design: 251.1. Now in matte black. (Plus a new water repellent ripstop mesh and a little touch of silver reflective detail for the winter)…",
"hashtags": [],
"emails": [],
"published_time": "2 years ago",
"published_at": "2023-11-09T09:12:59.511894-08:00",
"is_edited": false,
"vote_count": 31000,
"comment_count": null,
"links": [
{
"url": "https://atoms.com/products/mkbhd251-1",
"link_type": "website",
"label": "https://atoms.com/products/mkbhd251-1",
"channel_id": null,
"video_id": null
}
],
"attachment_type": "multi_image",
"attached_video": null,
"image_count": 4,
"images": [
{
"image_url": "https://example.com/image.jpg",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/DRQFUxLpjmjn-SYaIqWGtXLcx-pD78rqnmhk-yhQEaOSMbQObQMQqkTao0PBQk624sCrRVXZN_29=s288-c-fcrop64=1,000024ddfffff1a9-rw-nd-v1",
"width": 288,
"height": 288
},
{
"url": "https://yt3.ggpht.com/DRQFUxLpjmjn-SYaIqWGtXLcx-pD78rqnmhk-yhQEaOSMbQObQMQqkTao0PBQk624sCrRVXZN_29=s400-c-fcrop64=1,000024ddfffff1a9-rw-nd-v1",
"width": 400,
"height": 400
},
{
"_more_items": 7
}
]
},
{
"image_url": "https://example.com/image.jpg",
"thumbnails": [
{
"url": "https://yt3.ggpht.com/TojFATEOvYO3-sFbqEAv7Q4aijzby4KMxTWomslL5KLrEud-TBqJkvIEvEbdH50saRwEBaUnziF1Fg=s288-c-fcrop64=1,0000199affffe666-rw-nd-v1",
"width": 288,
"height": 288
},
{
"url": "https://yt3.ggpht.com/TojFATEOvYO3-sFbqEAv7Q4aijzby4KMxTWomslL5KLrEud-TBqJkvIEvEbdH50saRwEBaUnziF1Fg=s400-c-fcrop64=1,0000199affffe666-rw-nd-v1",
"width": 400,
"height": 400
},
{
"_more_items": 7
}
]
},
{
"_more_items": 2
}
]
}
}
}
このコンパクトな JSON の例は、V1 の直近の成功した検証実行から取得したものです。
{
"success": true,
"status": "ok",
"search_context": {
"post_id": "Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok"
},
"data": {
"responseContext": {
"serviceTrackingParams": [
{
"service": "GFEEDBACK",
"params": [
{
"key": "browse_id",
"value": "FEpost_detail"
},
{
"key": "browse_id_prefix",
"value": ""
},
{
"_more_items": 2
}
]
},
{
"service": "GOOGLE_HELP",
"params": [
{
"key": "browse_id",
"value": "FEpost_detail"
},
{
"key": "browse_id_prefix",
"value": ""
}
]
},
{
"_more_items": 3
}
],
"maxAgeSeconds": 0,
"mainAppWebResponseContext": {
"loggedOut": true,
"trackingParam": "k5_fmPxhoXZRWwgkNg3o9CEE4Dq_c7sw3d7WwiKjsA6P62GedUno1JQXBwRMkusEmIBwOcCw59TLtslLKPQGSS"
},
"responseId": "IhMIqvX8jdXflQMVOAzLBB0a5iE7",
"webResponseContextExtensionData": {
"webResponseContextPreloadData": {
"preloadMessageNames": [
"channelMetadataRenderer",
"twoColumnBrowseResultsRenderer",
{
"_more_items": 29
}
]
},
"ytConfigData": {
"visitorData": "Cgt4N0JiRG5EMEVXRSjy_fTSBjIKCgJVUxIEGgAgDWLfAgrcAjIwLllUPUNfMWpRMHJlQk1McFpvcW96LW54NS03VzZrZUhaazNJU0pJVjh4bHM1NVdlakdMbjktUm5CeDVTaTAxVHhYc0ZGVkZ1a184cU9qNkVhazdpR2NoaXptT1gxY…",
"rootVisualElementType": 247244
},
"hasDecorated": true
}
},
"contents": {
"twoColumnBrowseResultsRenderer": {
"tabs": [
{
"tabRenderer": {
"title": "Posts",
"selected": true,
"content": "…",
"trackingParams": "CBIQ8JMBGAUiEwiq9fyN1d-VAxU4DMsEHRrmITs="
}
}
]
}
},
"metadata": {
"channelMetadataRenderer": {
"title": "Marques Brownlee",
"externalId": "UCBJycsmduvYEL83R_U4JriQ"
}
},
"trackingParams": "CAAQhGciEwiq9fyN1d-VAxU4DMsEHRrmITvKAQRetfVv",
"topbar": {
"desktopTopbarRenderer": {
"logo": {
"topbarLogoRenderer": {
"iconImage": {
"iconType": "YOUTUBE_LOGO"
},
"tooltipText": {
"runs": "…"
},
"endpoint": {
"clickTrackingParams": "CBEQsV4iEwiq9fyN1d-VAxU4DMsEHRrmITvKAQRetfVv",
"commandMetadata": "…",
"browseEndpoint": "…"
},
"trackingParams": "CBEQsV4iEwiq9fyN1d-VAxU4DMsEHRrmITs=",
"overrideEntityKey": "EgZ0b3BiYXIg9QEoAQ%3D%3D"
}
},
"searchbox": {
"fusionSearchboxRenderer": {
"icon": {
"iconType": "SEARCH"
},
"placeholderText": {
"runs": "…"
},
"config": {
"webSearchboxConfig": "…"
},
"trackingParams": "CA0Q7VAiEwiq9fyN1d-VAxU4DMsEHRrmITs=",
"searchEndpoint": {
"clickTrackingParams": "CA0Q7VAiEwiq9fyN1d-VAxU4DMsEHRrmITvKAQRetfVv",
"commandMetadata": "…",
"searchEndpoint": "…"
},
"clearButton": {
"buttonRenderer": "…"
},
"showImageSourceDialog": {
"clickTrackingParams": "CA0Q7VAiEwiq9fyN1d-VAxU4DMsEHRrmITvKAQRetfVv",
"showDialogCommand": "…"
},
"disableAiAppearance": true
}
},
"trackingParams": "CAEQq6wBIhMIqvX8jdXflQMVOAzLBB0a5iE7",
"topbarButtons": [
{
"topbarMenuButtonRenderer": {
"icon": "…",
"menuRequest": "…",
"trackingParams": "CAsQ_qsBGAAiEwiq9fyN1d-VAxU4DMsEHRrmITs=",
"accessibility": "…",
"tooltip": "Settings",
"style": "STYLE_DEFAULT"
}
},
{
"buttonRenderer": {
"style": "STYLE_SUGGESTIVE",
"size": "SIZE_SMALL",
"text": "…",
"icon": "…",
"navigationEndpoint": "…",
"trackingParams": "CAoQ1IAEGAEiEwiq9fyN1d-VAxU4DMsEHRrmITs=",
"targetId": "topbar-signin"
}
}
],
"hotkeyDialog": {
"hotkeyDialogRenderer": {
"title": {
"runs": "…"
},
"sections": [
"…",
"…",
{
"_more_items": 2
}
],
"dismissButton": {
"buttonRenderer": "…"
},
"trackingParams": "CAgQteYDIhMIqvX8jdXflQMVOAzLBB0a5iE7"
}
},
"backButton": {
"buttonRenderer": {
"trackingParams": "CAcQvIYDIhMIqvX8jdXflQMVOAzLBB0a5iE7",
"command": {
"clickTrackingParams": "CAcQvIYDIhMIqvX8jdXflQMVOAzLBB0a5iE7ygEEXrX1bw==",
"commandMetadata": "…",
"signalServiceEndpoint": "…"
}
}
},
"forwardButton": {
"buttonRenderer": {
"trackingParams": "CAYQvYYDIhMIqvX8jdXflQMVOAzLBB0a5iE7",
"command": {
"clickTrackingParams": "CAYQvYYDIhMIqvX8jdXflQMVOAzLBB0a5iE7ygEEXrX1bw==",
"commandMetadata": "…",
"signalServiceEndpoint": "…"
}
}
},
"a11ySkipNavigationButton": {
"buttonRenderer": {
"style": "STYLE_DEFAULT",
"size": "SIZE_DEFAULT",
"isDisabled": false,
"text": {
"runs": "…"
},
"trackingParams": "CAUQ8FsiEwiq9fyN1d-VAxU4DMsEHRrmITs=",
"command": {
"clickTrackingParams": "CAUQ8FsiEwiq9fyN1d-VAxU4DMsEHRrmITvKAQRetfVv",
"commandMetadata": "…",
"signalServiceEndpoint": "…"
}
}
},
"voiceSearchButton": {
"buttonRenderer": {
"style": "STYLE_DEFAULT",
"size": "SIZE_DEFAULT",
"isDisabled": false,
"serviceEndpoint": {
"clickTrackingParams": "CAIQ7a8FIhMIqvX8jdXflQMVOAzLBB0a5iE7ygEEXrX1bw==",
"commandMetadata": "…",
"signalServiceEndpoint": "…"
},
"icon": {
"iconType": "MICROPHONE_ON"
},
"tooltip": "Search with your voice",
"trackingParams": "CAIQ7a8FIhMIqvX8jdXflQMVOAzLBB0a5iE7",
"accessibilityData": {
"accessibilityData": "…"
}
}
}
}
},
"microformat": {
"microformatDataRenderer": {
"urlCanonical": "https://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
"title": "Post from Marques Brownlee",
"description": "Introducing a new colorway and updated design: 251.1. Now in matte black. (Plus a new water repellent ripstop mesh and a little touch of silver reflective de...",
"thumbnail": {
"thumbnails": [
{
"url": "https://yt3.ggpht.com/DRQFUxLpjmjn-SYaIqWGtXLcx-pD78rqnmhk-yhQEaOSMbQObQMQqkTao0PBQk624sCrRVXZN_29=s2048-c-fcrop64=1,000024ddfffff1a9-rw-nd-v1?days_since_epoch=20653",
"width": 2048,
"height": 2048
}
]
},
"siteName": "YouTube",
"appName": "YouTube",
"androidPackage": "com.google.android.youtube",
"iosAppStoreId": "544007664",
"iosAppArguments": "https://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok",
"ogType": "yt-fb-app:channel",
"urlApplinksWeb": "https://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok?feature=applinks",
"urlApplinksIos": "vnd.youtube://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok?feature=applinks",
"urlApplinksAndroid": "vnd.youtube://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok?feature=applinks",
"urlTwitterIos": "vnd.youtube://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok?feature=twitter-deep-link",
"urlTwitterAndroid": "vnd.youtube://www.youtube.com/post/Ugkxa3BN5SFLT-KGgPZYyJlmsaR_vGGhu9ok?feature=twitter-deep-link",
"twitterCardType": "summary",
"twitterSiteHandle": "@YouTube",
"schemaDotOrgType": "http://schema.org/http://schema.org/YoutubeChannelV2",
"noindex": false,
"unlisted": false,
"familySafe": true,
"tags": [
"MKBHD",
"MarquesBrownlee",
{
"_more_items": 2
}
],
"availableCountries": [
"TZ",
"KI",
{
"_more_items": 247
}
],
"pageOwnerDetails": {
"name": "Marques Brownlee"
},
"_more_fields": "3 more fields"
}
}
}
}
このドキュメントを最初の判断材料とし、継続的な利用のためにエンドポイントを接続する前に、料金、プラットフォームのカバー範囲、連携ルールを確認してください。
これらの回答を参考に、この API メソッドがワークフロー、バージョンの選択、導入計画に合うかどうかを判断してください。
このメソッドは 投稿 に対して「投稿 ID による詳細」を実行します。以下のコンパクトなレスポンス例で、フィールドの正確な構造を確認できます。
新しい連携では、正規化された構造を提供する V2 を選んでください。V1 は、既にプラットフォーム固有の形式を処理しているクライアントとの互換性のためにのみ使用してください。
API キーを作成し、リクエストヘッダーで送信し、表の必須パラメーターを指定してください。コード例には、正しいパスとリクエスト構造が既に含まれています。