此端点可以帮助您
响应以规范化的 V2 格式或平台原生的 V1 格式提供可用的帖子字段。
何时使用
当对象已知、您的产品需要其当前公开上下文时,请使用“按帖子 ID 获取详情”。
先查看结果和常见工作流,然后再了解参数和可运行的请求示例。
响应以规范化的 V2 格式或平台原生的 V1 格式提供可用的帖子字段。
当对象已知、您的产品需要其当前公开上下文时,请使用“按帖子 ID 获取详情”。
将公开的 X/Twitter 字段附加到已知的产品对象上。
在后续处理之前验证标识符和当前的公开上下文。
将对象详情用作报告、评分和相关请求的输入。
两个版本完成相同的任务,接受相同的参数。使用切换按钮比较响应结构,并选择您的客户端所需的版本。
在本页面切换版本,即可在同一文档 URL 下比较响应结构。
V1 和 V2 的身份验证、必填参数和请求结构均相同。实际上,您只需在构建端点路径和解析响应时选择版本。
主要区别在于响应结构。新集成请使用 V2;仅在需要兼容现有客户端契约时保留 V1。
两个版本使用相同的 API 密钥请求头和相同的查询参数。本文档先展示共享的参数集合,然后展示各版本特定的端点路径和代码片段。
| 参数 | 必填 | 类型 | 示例 | 说明 |
|---|---|---|---|---|
tweet_id |
是 | str |
1153155448012300288 |
Numeric Twitter/X post identifier. Example: 1153155448012300288. |
复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。
GET /api/v2/twitter.com/tweets/details-by-tweet-idcurl --request GET \
--url "https://www.scrapestorm.net/api/v2/twitter.com/tweets/details-by-tweet-id" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'tweet_id=1153155448012300288'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v2/twitter.com/tweets/details-by-tweet-id"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"tweet_id": "1153155448012300288",
}
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/twitter.com/tweets/details-by-tweet-id";
const params = new URLSearchParams({
tweet_id: "1153155448012300288",
});
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 = {
tweet_id: "1153155448012300288",
};
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 = [
"tweet_id" => "1153155448012300288",
];
try {
$response = $client->request("GET", "/api/v2/twitter.com/tweets/details-by-tweet-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/twitter.com/tweets/details-by-tweet-id"
params := url.Values{}
params.Set("tweet_id", "1153155448012300288")
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/twitter.com/tweets/details-by-tweet-idcurl --request GET \
--url "https://www.scrapestorm.net/api/v1/twitter.com/tweets/details-by-tweet-id" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'tweet_id=1153155448012300288'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v1/twitter.com/tweets/details-by-tweet-id"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"tweet_id": "1153155448012300288",
}
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/twitter.com/tweets/details-by-tweet-id";
const params = new URLSearchParams({
tweet_id: "1153155448012300288",
});
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 = {
tweet_id: "1153155448012300288",
};
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 = [
"tweet_id" => "1153155448012300288",
];
try {
$response = $client->request("GET", "/api/v1/twitter.com/tweets/details-by-tweet-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/twitter.com/tweets/details-by-tweet-id"
params := url.Values{}
params.Set("tweet_id", "1153155448012300288")
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": {
"tweet_id": "1153155448012300288"
},
"data": {
"tweet": {
"url": "https://x.com/elonmusk/status/1153155448012300288",
"tweet_id": "1153155448012300288",
"text": "I am become meme",
"hashtags": [],
"emails": [],
"created_at": "2019-07-22T04:10:58Z",
"language": "en",
"source": "Twitter for iPhone",
"author": {
"url": "https://x.com/elonmusk",
"user_id": "44196397",
"username": "elonmusk",
"display_name": "Elon Musk",
"description": "Starmind",
"emails": [],
"external_links": [],
"location": null,
"created_at": "2009-06-02T20:12:29Z",
"is_verified": false,
"is_blue_verified": true,
"is_protected": false,
"possibly_sensitive": false,
"default_profile": false,
"default_profile_image": false,
"followers_count": 240944565,
"following_count": 1370,
"tweet_count": 105744,
"media_count": 4625,
"listed_count": 170041,
"like_count": 239681,
"professional_type": "Creator",
"professional_category_name": null,
"affiliated_account": {
"label": "X",
"url": "https://x.com/X",
"badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
"label_type": "BusinessLabel"
},
"_more_fields": "5 more fields"
},
"is_from_automated_account": null,
"media": {
"images": [],
"videos": [],
"gifs": []
},
"external_links": [],
"user_mentions": [],
"is_reply": false,
"reply": null,
"is_quote": false,
"quote_tweet_id": null,
"is_retweet": false,
"retweeted_tweet_id": null,
"reply_count": 4907,
"retweet_count": 37064,
"quote_count": 2295,
"like_count": 301766,
"bookmark_count": 636,
"_more_fields": "2 more fields"
}
}
}
此简明 JSON 示例来自 V1 最近一次成功的验证运行。
{
"success": true,
"status": "ok",
"search_context": {
"tweet_id": "1153155448012300288"
},
"data": {
"data": {
"tweetResult": {
"result": {
"__typename": "Tweet",
"cashtag_attachments": [],
"core": {
"user_results": {
"result": "…"
}
},
"edit_control": {
"edit_tweet_ids": [
"1153155448012300288"
],
"editable_until_msecs": "1563770458055",
"edits_remaining": "5",
"is_edit_eligible": true
},
"grok_analysis_button": true,
"grok_annotations": {},
"grok_translated_post_with_availability": {
"is_available": false
},
"is_translatable": false,
"legacy": {
"bookmark_count": 636,
"bookmarked": false,
"conversation_id_str": "1153155448012300288",
"created_at": "Mon Jul 22 04:10:58 +0000 2019",
"display_text_range": [
0,
16
],
"entities": {},
"favorite_count": 301766,
"favorited": false,
"full_text": "I am become meme",
"id_str": "1153155448012300288",
"is_quote_status": false,
"lang": "en",
"quote_count": 2295,
"reply_count": 4907,
"retweet_count": 37064,
"retweeted": false,
"user_id_str": "44196397"
},
"rest_id": "1153155448012300288",
"source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
"unmention_data": {},
"views": {
"state": "Enabled"
}
}
}
}
}
}
将本文档作为第一个决策点,然后在将端点接入常规使用之前,继续了解价格、平台覆盖范围和集成规则。
借助这些解答,判断此 API 方法是否适合您的工作流、版本选择和上线计划。
该方法针对帖子执行“按帖子 ID 获取详情”操作。下方的简明响应示例展示了确切的字段结构。
新集成请选择 V2,因为它提供规范化的结构。仅在兼容已使用平台原生格式的客户端时使用 V1。
创建 API 密钥,在请求头中发送它,并提供表格中的必填参数。代码示例中已包含正确的路径和请求结构。