- tweetsAndReplies - Get All Tweets and Replies by User
- userPage - Get User Timeline by Page
- user - Get User Timeline and Fill Count
- tweetsAndRepliesPage - Get All Tweets and Replies by User by Page
Get all tweets and replies posted by a specific Twitter user. Returns a comprehensive list including both original tweets and reply tweets posted by the user. $0.10/1000 items.
import { XApiScraper } from "@twexapi-dev/x-api-scraper";
const xApiScraper = new XApiScraper({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await xApiScraper.timelines.tweetsAndReplies({
screenName: "elonmusk",
count: 50,
});
console.log(result);
}
run();The standalone function version of this method:
import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { timelinesTweetsAndReplies } from "@twexapi-dev/x-api-scraper/funcs/timelines-tweets-and-replies.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 timelinesTweetsAndReplies(xApiScraper, {
screenName: "elonmusk",
count: 50,
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("timelinesTweetsAndReplies failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.TimelinesTweetsAndRepliesRequest | ✔️ | 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.SearchResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XAPIScraperDefaultError | 4XX, 5XX | */* |
Fetch a single page from a user's timeline using POST. Pass next_cursor in the body to continue.
import { XApiScraper } from "@twexapi-dev/x-api-scraper";
const xApiScraper = new XApiScraper({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await xApiScraper.timelines.userPage({
screenName: "axiaisacat",
body: {
nextCursor: "DAAHCgABHFeD5h9__-cLAAIAAAATMjAzODIzMzA5NTM4ODY4MDU5NAgAAwAAAAIAAA",
},
});
console.log(result);
}
run();The standalone function version of this method:
import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { timelinesUserPage } from "@twexapi-dev/x-api-scraper/funcs/timelines-user-page.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 timelinesUserPage(xApiScraper, {
screenName: "axiaisacat",
body: {
nextCursor: "DAAHCgABHFeD5h9__-cLAAIAAAATMjAzODIzMzA5NTM4ODY4MDU5NAgAAwAAAAIAAA",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("timelinesUserPage failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.TimelinesUserPageRequest | ✔️ | 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.UserTimelinePageResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XAPIScraperDefaultError | 4XX, 5XX | */* |
Fetch a user's timeline across pages using POST and try to fill the requested count.
import { XApiScraper } from "@twexapi-dev/x-api-scraper";
const xApiScraper = new XApiScraper({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await xApiScraper.timelines.user({
screenName: "axiaisacat",
body: {},
});
console.log(result);
}
run();The standalone function version of this method:
import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { timelinesUser } from "@twexapi-dev/x-api-scraper/funcs/timelines-user.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 timelinesUser(xApiScraper, {
screenName: "axiaisacat",
body: {},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("timelinesUser failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.TimelinesUserRequest | ✔️ | 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.UserTimelineResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XAPIScraperDefaultError | 4XX, 5XX | */* |
Retrieve a paginated list of a user's tweets and replies using cursor-based pagination. Each page returns up to 20 items. Pass next_cursor from the previous response to continue. Pricing: $0.10 per 1,000 items.
import { XApiScraper } from "@twexapi-dev/x-api-scraper";
const xApiScraper = new XApiScraper({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await xApiScraper.timelines.tweetsAndRepliesPage({
nextCursor: "1234567890",
screenName: "elonmusk",
});
console.log(result);
}
run();The standalone function version of this method:
import { XApiScraperCore } from "@twexapi-dev/x-api-scraper/core.js";
import { timelinesTweetsAndRepliesPage } from "@twexapi-dev/x-api-scraper/funcs/timelines-tweets-and-replies-page.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 timelinesTweetsAndRepliesPage(xApiScraper, {
nextCursor: "1234567890",
screenName: "elonmusk",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("timelinesTweetsAndRepliesPage failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
models.GetAllTweetsRepliesCursorQuery | ✔️ | 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.GetAllTweetsRepliesCursorResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.XAPIScraperDefaultError | 4XX, 5XX | */* |