- list - Get Following (v3)
Get following list of a user. Page size 10-100; use cursor for more pages. $0.10/1000 users.
import { XApiScraper } from "@twexapi-dev/x-api-scraper";
const xApiScraper = new XApiScraper({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await xApiScraper.users.following.list({
username: "elonmusk",
count: 20,
cursor: "1870681402093130182|2076960004551737340",
});
console.log(result);
}
run();The standalone function version of this method:
import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { usersFollowingList } from "@twexapi-dev/x-api-scraper/funcs/users-following-list.js";
// Use `XApiScraperCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const xApiScraper = new XApiScraperCore({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const res = await usersFollowingList(xApiScraper, {
username: "elonmusk",
count: 20,
cursor: "1870681402093130182|2076960004551737340",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("usersFollowingList failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.FollowersFollowingV3Query | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<models.VerifiedFollowersResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XAPIScraperDefaultError | 4XX, 5XX | */* |