Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 4.46 KB

File metadata and controls

94 lines (63 loc) · 4.46 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

require 'x_api_scraper'

Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
  bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)

req = [
  '1803006263529541838',
]
res = s.articles.fetch(request: req)

unless res.x_article_response.nil?
  # handle response
end

Parameters

Parameter Type Required Description
request T::Array[::String] ✔️ The request object to use for the request.

Response

T.nilable(Models::Operations::ArticlesFetchResponse)

Errors

Error Type Status Code Content Type
Models::Errors::HTTPValidationError 422 application/json
Errors::APIError 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

require 'x_api_scraper'

Models = ::XapiScraper::Models
s = ::XapiScraper::Client.new(
  bearer_auth: '<YOUR_BEARER_TOKEN_HERE>'
)

req = Models::Operations::ArticlesMarkdownRequest.new(
  tweet_id: '<id>'
)
res = s.articles.markdown(request: req)

unless res.res.nil?
  # handle response
end

Parameters

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

Response

T.nilable(Models::Operations::ArticlesMarkdownResponse)

Errors

Error Type Status Code Content Type
Models::Errors::HTTPValidationError 422 application/json
Errors::APIError 4XX, 5XX */*