Skip to content

Latest commit

 

History

History
92 lines (59 loc) · 4.67 KB

File metadata and controls

92 lines (59 loc) · 4.67 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

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.articles.fetch(request=[
        "1803006263529541838",
    ])

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request List[str] ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.XArticleResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.XapiScraperDefaultError 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

import os
from x_api_scraper import XapiScraper


with XapiScraper(
    bearer_auth=os.getenv("X_API_SCRAPER_BEARER_AUTH", ""),
) as xapi_scraper:

    res = xapi_scraper.articles.markdown(tweet_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
tweet_id str ✔️ The tweet ID of the article to get.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

str

Errors

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