Skip to content

Latest commit

 

History

History
120 lines (83 loc) · 5.26 KB

File metadata and controls

120 lines (83 loc) · 5.26 KB

Articles

Overview

Available Operations

  • fetch - Batch Fetch X Articles
  • markdown - Fetch Article as Markdown

fetch

Retrieves detailed article content for a specified list of X (Twitter) IDs. Use this endpoint to fetch full text, metadata, and media links for multiple posts in a single request. The maximum input quantity is limited by your plan's QPS. To pass larger input quantity limits, upgrade your plan to get higher QPS.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.ArticlesFetchResponse;
import java.lang.Exception;
import java.lang.String;
import java.util.List;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        List<String> req = List.of(
                "1803006263529541838");

        ArticlesFetchResponse res = sdk.articles().fetch()
                .request(req)
                .call();

        if (res.xArticleResponse().isPresent()) {
            System.out.println(res.xArticleResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request List ✔️ The request object to use for the request.

Response

ArticlesFetchResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 4XX, 5XX */*

markdown

Retrieves the content of an X (Twitter) article formatted as clean, valid Markdown. The response body is delivered as a raw UTF-8 string, optimized for direct import into static site generators, Obsidian, Notion, or any standard Markdown editor.

Example Usage

package hello.world;

import io.twexapi.sdk.XapiScraper;
import io.twexapi.sdk.models.errors.HTTPValidationError;
import io.twexapi.sdk.models.operations.ArticlesMarkdownRequest;
import io.twexapi.sdk.models.operations.ArticlesMarkdownResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws HTTPValidationError, Exception {

        XapiScraper sdk = XapiScraper.builder()
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        ArticlesMarkdownRequest req = ArticlesMarkdownRequest.builder()
                .tweetId("<id>")
                .build();

        ArticlesMarkdownResponse res = sdk.articles().markdown()
                .request(req)
                .call();

        if (res.res().isPresent()) {
            System.out.println(res.res().get());
        }
    }
}

Parameters

Parameter Type Required Description
request ArticlesMarkdownRequest ✔️ The request object to use for the request.

Response

ArticlesMarkdownResponse

Errors

Error Type Status Code Content Type
models/errors/HTTPValidationError 422 application/json
models/errors/APIException 4XX, 5XX */*