> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 按用户名发现 X (Twitter) 个人资料

> 使用 Bright Data Scraper API 按账号用户名发现 X (Twitter) 个人资料数据。发送 POST /datasets/v3/scrape 请求，dataset_id 为 gd_lwxmeb2u1cniijd7t4。

## 查询参数

<ParamField query="dataset_id" type="string" default="gd_lwxmeb2u1cniijd7t4" required>
  用于此请求的数据集ID。

  <Warning>
    必须设置为 `gd_lwxmeb2u1cniijd7t4` 以收集**按用户名发现**数据。
  </Warning>
</ParamField>

<ParamField query="type" type="string" default="discover_new">
  必须设置为 `discover_new`。
</ParamField>

<ParamField query="discover_by" type="string" default="user_name">
  必须设置为 `user_name`。
</ParamField>

<ParamField query="notify" type="boolean" default={false}>
  请求完成时是否发送通知。
</ParamField>

<ParamField query="include_errors" type="boolean" default={true}>
  是否在响应中包含错误。
</ParamField>

## 请求体

<ParamField body="input" type="object[]" required>
  输入对象的数组。

  <Expandable title="properties">
    <ParamField body="user_name" type="string" required>
      X.com 个人资料的用户名。
    </ParamField>
  </Expandable>

  #### 示例

  ```json wrap theme={null}
  {
    "input": [
      {"user_name": "elonmusk"}
    ]
  }
  ```
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"input":[{"user_name":"elonmusk"}],"limit_per_input":null}' \
    "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_lwxmeb2u1cniijd7t4&notify=false&include_errors=true&type=discover_new&discover_by=user_name"
  ```

  ```python Python (requests) theme={null}
  import requests

  response = requests.post(
      "https://api.brightdata.com/datasets/v3/scrape",
      params={
          "dataset_id": "gd_lwxmeb2u1cniijd7t4",
          "notify": "false",
          "include_errors": "true",
          "type": "discover_new",
          "discover_by": "user_name",
      },
      headers={"Authorization": "Bearer YOUR_API_KEY"},
      json={
          "input": [{"user_name": "elonmusk"}],
          "limit_per_input": None,
      },
  )

  print(response.text)
  ```

  ```javascript Node.js (fetch) theme={null}
  const params = new URLSearchParams({
    dataset_id: "gd_lwxmeb2u1cniijd7t4",
    notify: "false",
    include_errors: "true",
    type: "discover_new",
    discover_by: "user_name",
  });

  const response = await fetch(`https://api.brightdata.com/datasets/v3/scrape?${params}`, {
    method: "POST",
    headers: {
      "Authorization": "Bearer YOUR_API_KEY",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      input: [{ user_name: "elonmusk" }],
      limit_per_input: null,
    }),
  });

  console.log(await response.text());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  [
    {
      "x_id": "1077446982",
      "url": "https://x.com/RepRWilliams",
      "id": "RepRWilliams",
      "profile_name": "Rep. Roger Williams",
      "biography": "Chairman of @HouseSmallBiz. Conservative fighting for lower taxes, less regulations, and more freedom for Texans.",
      "is_verified": true,
      "profile_image_link": "https://pbs.twimg.com/...",
      "external_link": "https://williams.house.gov/",
      "date_joined": "2013-01-10T19:21:22.000Z",
      "following": 910,
      "followers": 24746,
      "subscriptions": 0,
      "location": "North Texas",
      "birth_date": null,
      "posts_count": 10434,
      "posts": [
        {
          "date_posted": "2026-04-07T19:10:38.000Z",
          "description": "As Chairman of @HouseSmallBiz, I have seen the positive impact the Working Families Tax Cuts have had on small businesses.",
          "likes": 6,
          "post_id": "2041594516373700624",
          "post_url": "https://x.com/RepRWilliams/status/2041594516373700624",
          "replies": 3,
          "reposts": 3,
          "views": 449
        }
      ],
      "is_business_account": false,
      "is_government_account": false,
      "banner_image": "https://pbs.twimg.com/..."
    }
  ]
  ```
</ResponseExample>
