此端点可以帮助您
响应以所选 API 格式提供现成的个人资料摘要,包含关键计数和指标。
何时使用
将“按用户名获取帖子指标”用于需要简明指标快照的仪表板、评分和定期报告。
先查看结果和常见工作流,然后再了解参数和可运行的请求示例。
响应以所选 API 格式提供现成的个人资料摘要,包含关键计数和指标。
将“按用户名获取帖子指标”用于需要简明指标快照的仪表板、评分和定期报告。
无需加载和处理整个集合即可展示 X/Twitter 的核心指标。
定期保存快照,并比较指标随时间的变化。
将汇总指标作为内部排名和规则的输入。
两个版本完成相同的任务,接受相同的参数。使用切换按钮比较响应结构,并选择您的客户端所需的版本。
在本页面切换版本,即可在同一文档 URL 下比较响应结构。
V1 和 V2 的身份验证、必填参数和请求结构均相同。实际上,您只需在构建端点路径和解析响应时选择版本。
主要区别在于响应结构。新集成请使用 V2;仅在需要兼容现有客户端契约时保留 V1。
两个版本使用相同的 API 密钥请求头和相同的查询参数。本文档先展示共享的参数集合,然后展示各版本特定的端点路径和代码片段。
| 参数 | 必填 | 类型 | 示例 | 说明 |
|---|---|---|---|---|
username |
是 | str |
elonmusk |
不带 @ 符号的公开用户名。 |
复制确切的端点路径、示例 URL 和代码片段时请选择版本。上方的参数列表保持不变。
GET /api/v2/twitter.com/profile/tweets-metrics-by-usernamecurl --request GET \
--url "https://www.scrapestorm.net/api/v2/twitter.com/profile/tweets-metrics-by-username" \
--header "X-API-Key: 00000000-0000-4000-8000-000000000000" \
--get --data-urlencode 'username=elonmusk'
from urllib.parse import urljoin
import requests
BASE_URL = "https://www.scrapestorm.net"
ENDPOINT = "/api/v2/twitter.com/profile/tweets-metrics-by-username"
HEADERS = {"Accept": "application/json", "X-API-Key": "00000000-0000-4000-8000-000000000000"}
params = {
"username": "elonmusk",
}
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/profile/tweets-metrics-by-username";
const params = new URLSearchParams({
username: "elonmusk",
});
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 = {
username: "elonmusk",
};
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 = [
"username" => "elonmusk",
];
try {
$response = $client->request("GET", "/api/v2/twitter.com/profile/tweets-metrics-by-username", [
'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/profile/tweets-metrics-by-username"
params := url.Values{}
params.Set("username", "elonmusk")
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": {
"username": "elonmusk"
},
"data": {
"user": {
"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": 240944558,
"following_count": 1370,
"tweet_count": 105744,
"media_count": 4625,
"highlighted_tweets_count": 1022,
"listed_count": 170041,
"like_count": 239681,
"creator_subscriptions_count": 244,
"professional_type": "Creator",
"_more_fields": "8 more fields"
},
"analytics": {
"all_posts": {
"analyzed_posts_count": 20,
"last_post_date": "2026-07-19T20:29:24+00:00",
"total_engagement": 334544,
"avg_engagement_rate_per_post": 0.006942,
"peak_engagement_rate_per_post": 0.061887,
"avg_weighted_engagement_score": 19457.725,
"total_engagement_rate": 0.138847,
"median_engagement_per_post": 9020.5,
"max_engagement_per_post": 149113,
"avg_caption_length": 78,
"avg_posts_per_week": 7,
"avg_posts_per_month": 30,
"posts_count_last_7_days": 20,
"posts_count_last_30_days": 20,
"total_likes": 225598,
"total_replies": 28008,
"total_retweets": 61376,
"total_quotes": 3797,
"total_bookmarks": 15765,
"total_views": 35780587,
"avg_likes_per_post": 11280,
"avg_replies_per_post": 1400,
"avg_retweets_per_post": 3069,
"avg_quotes_per_post": 190,
"_more_fields": "15 more fields"
},
"sponsored_posts": {
"analyzed_posts_count": 0,
"total_engagement": 0,
"avg_engagement_rate_per_post": 0.0,
"peak_engagement_rate_per_post": 0.0,
"avg_weighted_engagement_score": 0.0,
"total_engagement_rate": 0.0,
"median_engagement_per_post": 0.0,
"max_engagement_per_post": 0,
"avg_caption_length": 0,
"avg_posts_per_week": 0,
"avg_posts_per_month": 0,
"posts_count_last_7_days": 0,
"posts_count_last_30_days": 0
},
"organic_posts": {
"analyzed_posts_count": 20,
"last_post_date": "2026-07-19T20:29:24+00:00",
"total_engagement": 334544,
"avg_engagement_rate_per_post": 0.006942,
"peak_engagement_rate_per_post": 0.061887,
"avg_weighted_engagement_score": 19457.725,
"total_engagement_rate": 0.138847,
"median_engagement_per_post": 9020.5,
"max_engagement_per_post": 149113,
"avg_caption_length": 78,
"avg_posts_per_week": 7,
"avg_posts_per_month": 30,
"posts_count_last_7_days": 20,
"posts_count_last_30_days": 20,
"total_likes": 225598,
"total_replies": 28008,
"total_retweets": 61376,
"total_quotes": 3797,
"total_bookmarks": 15765,
"total_views": 35780587,
"avg_likes_per_post": 11280,
"avg_replies_per_post": 1400,
"avg_retweets_per_post": 3069,
"avg_quotes_per_post": 190,
"_more_fields": "15 more fields"
},
"segment_comparison": {
"sponsored_content_share": 0.0,
"organic_content_share": 100.0,
"organic_vs_sponsored_engagement_rate_gap": 0.0069,
"sponsored_to_organic_avg_engagement_ratio": 0.0
}
},
"feed": {
"count": 20,
"items": [
{
"url": "https://x.com/elonmusk/status/2078940289226482120",
"tweet_id": "2078940289226482120",
"text": "RT @PeterDiamandis: The first phone call across the Atlantic, in 1927, cost about seventy five dollars for three minutes, more than a thous…",
"created_at": "2026-07-19T20:29:24Z",
"language": "en",
"source": "Twitter for iPhone",
"author": {
"url": "https://x.com/elonmusk",
"user_id": "44196397",
"username": "elonmusk",
"display_name": "Elon Musk",
"description": "Starmind",
"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": 240944556,
"following_count": 1370,
"tweet_count": 105744,
"media_count": 4625,
"listed_count": 170041,
"like_count": 239681,
"professional_type": "Creator",
"affiliated_account": {
"label": "X",
"url": "https://x.com/X",
"badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
"label_type": "BusinessLabel"
},
"avatar_url": "https://example.com/image.jpg",
"banner_url": "https://pbs.twimg.com/profile_banners/44196397/1774145451"
},
"user_mentions": [
{
"user_id": "14710129",
"username": "PeterDiamandis",
"display_name": "Peter H. Diamandis, MD",
"start_index": 3,
"end_index": 18
}
],
"is_reply": false,
"is_quote": false,
"is_retweet": true,
"retweeted_tweet_id": "2078903115248460118",
"reply_count": 0,
"retweet_count": 296,
"quote_count": 0,
"like_count": 0,
"bookmark_count": 0,
"view_count": 461419,
"edit_control": {
"is_editable": false,
"editable_until": "2026-07-19T21:29:24.451000Z",
"edits_remaining": 5
},
"is_sponsored": false,
"sponsored_detection_source": null,
"sponsored_detection_confidence": null
},
{
"url": "https://x.com/elonmusk/status/2078939898870903135",
"tweet_id": "2078939898870903135",
"text": "RT @PeterDiamandis: SpaceX's newest satellites carry about 1,024 gigabits of bandwidth each. The generation before carried 96. That is a te…",
"created_at": "2026-07-19T20:27:51Z",
"language": "en",
"source": "Twitter for iPhone",
"author": {
"url": "https://x.com/elonmusk",
"user_id": "44196397",
"username": "elonmusk",
"display_name": "Elon Musk",
"description": "Starmind",
"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": 240944556,
"following_count": 1370,
"tweet_count": 105744,
"media_count": 4625,
"listed_count": 170041,
"like_count": 239681,
"professional_type": "Creator",
"affiliated_account": {
"label": "X",
"url": "https://x.com/X",
"badge_url": "https://pbs.twimg.com/profile_images/1955359038532653056/OSHY3ewP_bigger.jpg",
"label_type": "BusinessLabel"
},
"avatar_url": "https://example.com/image.jpg",
"banner_url": "https://pbs.twimg.com/profile_banners/44196397/1774145451"
},
"user_mentions": [
{
"user_id": "14710129",
"username": "PeterDiamandis",
"display_name": "Peter H. Diamandis, MD",
"start_index": 3,
"end_index": 18
}
],
"is_reply": false,
"is_quote": false,
"is_retweet": true,
"retweeted_tweet_id": "2078933283539148891",
"reply_count": 0,
"retweet_count": 233,
"quote_count": 0,
"like_count": 0,
"bookmark_count": 0,
"view_count": 450028,
"edit_control": {
"is_editable": false,
"editable_until": "2026-07-19T21:27:51.383000Z",
"edits_remaining": 5
},
"is_sponsored": false,
"sponsored_detection_source": null,
"sponsored_detection_confidence": null
},
{
"_more_items": 18
}
]
}
}
}
将本文档作为第一个决策点,然后在将端点接入常规使用之前,继续了解价格、平台覆盖范围和集成规则。
借助这些解答,判断此 API 方法是否适合您的工作流、版本选择和上线计划。
该方法针对个人资料执行“按用户名获取帖子指标”操作。下方的简明响应示例展示了确切的字段结构。
新集成请选择 V2,因为它提供规范化的结构。仅在兼容已使用平台原生格式的客户端时使用 V1。
创建 API 密钥,在请求头中发送它,并提供表格中的必填参数。代码示例中已包含正确的路径和请求结构。