Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/FUNDING.yml

This file was deleted.

58 changes: 44 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,54 @@ concurrency:
cancel-in-progress: true

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/x-twitter-scraper-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: |-
github.repository == 'stainless-sdks/x-twitter-scraper-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: |-
github.repository == 'stainless-sdks/x-twitter-scraper-ruby' &&
!startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: x_twitter_scraper
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-24.04
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork

steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.0
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
Expand All @@ -48,16 +82,12 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ubuntu-24.04
runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.0
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
- run: |-
Expand Down
29 changes: 10 additions & 19 deletions .github/workflows/publish-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,13 @@ concurrency:

jobs:
publish:
name: Publish gem
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
environment:
name: rubygems
url: https://rubygems.org/gems/x-twitter-scraper
permissions:
contents: read
id-token: write # Required for RubyGems trusted publishing.
name: publish
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Ruby
uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.0
uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0
with:
bundler-cache: false
ruby-version: "3.2"
Expand All @@ -43,8 +32,10 @@ jobs:
- name: Build gem
run: bundle exec rake build:gem

- name: Configure RubyGems credentials (trusted publishing)
uses: rubygems/configure-rubygems-credentials@dc5a8d8553e6ee01fc26761a49e99e733d17954a # v2.1.0

- name: Publish to RubyGems.org
run: gem push x-twitter-scraper-*.gem
run: |
bash ./bin/publish-gem
env:
# `RUBYGEMS_HOST` is only required for private gem repositories, not https://rubygems.org
RUBYGEMS_HOST: ${{ secrets.X_TWITTER_SCRAPER_RUBYGEMS_HOST || secrets.RUBYGEMS_HOST }}
GEM_HOST_API_KEY: ${{ secrets.X_TWITTER_SCRAPER_GEM_HOST_API_KEY || secrets.GEM_HOST_API_KEY }}
32 changes: 0 additions & 32 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,3 @@ bin/tapioca
Brewfile.lock.json
doc/
sorbet/tapioca/*

# Public repo local safety
.env
.env.*
!.env.example
!.env.sample
.npmrc
.pypirc
*.pem
*.key
*.crt
*.p12
*.pfx
*.token
*.secret
*.log
*.log.*
.bundle/
coverage/
.cache/
.tmp/
tmp/
temp/
.codex/
.agents/
.claude/
.vscode/
.DS_Store
Thumbs.db
*.swp
*.swo
*~
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.4.5"
".": "0.5.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 122
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik/x-twitter-scraper-4665e942135459ff435542ae46122294c910986fdf19a0d2d33bc301817cf36f.yml
openapi_spec_hash: 564b37a7cb3edf100a82799631e287d9
config_hash: 7a9e1c37c84d207c5ee312091fffd2b0
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/xquik/x-twitter-scraper-a89d9fe0de8895b2daf847c8f3ff8bc93f43039c040d0bf093ec6dc1e734f57b.yml
openapi_spec_hash: c6365ebfe4f85183f384f27865cf66ce
config_hash: 9a418581d96f0820ef923bfe5ffa2541
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 0.5.0 (2026-07-22)

Full Changelog: [v0.4.5...v0.5.0](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.4.5...v0.5.0)

### Features

* **api:** propagate durable write actions ([b959adc](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/b959adc349d87f75be1dfb858c92479c637588d8))
* **api:** propagate production write-action contract ([b433f8d](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/b433f8d824bcb1ca60592d21d9f90b8baa79878a))
* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([9ad8d7c](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/9ad8d7c87cdd91232cf5ba76a5f5022d43cb7348))


### Bug Fixes

* **client:** elide content type header on requests without body ([b0186db](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/b0186db54e9074f563ae6528506fbd12d607d607))


### Chores

* **deps:** support connection_pool 3 ([ad578c2](https://github.com/Xquik-dev/x-twitter-scraper-ruby/commit/ad578c2453ff451f3317606f542baa491267a250))

## 0.4.4 (2026-07-14)

Full Changelog: [v0.4.3...v0.4.4](https://github.com/Xquik-dev/x-twitter-scraper-ruby/compare/v0.4.3...v0.4.4)
Expand Down
85 changes: 0 additions & 85 deletions CODE_OF_CONDUCT.md

This file was deleted.

8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ GIT
PATH
remote: .
specs:
x-twitter-scraper (0.4.5)
base64 (~> 0.3)
cgi (~> 0.5)
connection_pool (>= 2.5, < 4.0)
x-twitter-scraper (0.5.0)
base64
cgi
connection_pool

GEM
remote: https://rubygems.org/
Expand Down
50 changes: 8 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
# X (Twitter) Scraper Ruby SDK: Tweet Search, Profile Tweets, Followers & Posting
# Xquik Ruby SDK

> **Xquik is an independent third-party service.** Not affiliated with X Corp.
> "Twitter" and "X" are trademarks of X Corp.

[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/13739/badge)](https://www.bestpractices.dev/projects/13739)
[![Ask DeepWiki](https://deepwiki.com/badge.svg?url=https%3A%2F%2Fgithub.com%2FXquik-dev%2Fx-twitter-scraper-ruby)](https://deepwiki.com/Xquik-dev/x-twitter-scraper-ruby)
[![Skills.sh x-twitter-scraper Skill](https://skills.sh/b/xquik-dev/x-twitter-scraper)](https://skills.sh/xquik-dev/x-twitter-scraper)

The Xquik Ruby SDK is a Twitter API SDK and X API alternative for tweet search, advanced Twitter search queries, profile tweets, user lookup, follower export, media download, media upload, monitoring, webhooks, and posting automation.

Use it from Ruby 3.2.0+ applications to get tweets from profiles, search tweets by keyword or operator query, send tweets, post replies, like, repost, follow, DM, run giveaway draws, and automate X workflows. It ships with comprehensive types and docstrings in Yard, RBS, and RBI. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.

It is generated with [Stainless](https://www.stainless.com/).
Use the Xquik API from Ruby 3.2+. The SDK includes Yard, RBS, and RBI types. It uses `net/http` with connection pooling.

## Documentation

Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/x-twitter-scraper).

The REST API documentation can be found on [xquik.com](https://xquik.com).
Read the [Ruby SDK guide](https://docs.xquik.com/sdks/ruby), [API guide](https://docs.xquik.com/api-reference/overview), or [RubyDoc reference](https://gemdocs.org/gems/x-twitter-scraper).

## Installation

To use this gem, install via Bundler by adding the following to your application's `Gemfile`:
Add the gem to your `Gemfile`:

<!-- x-release-please-start-version -->

```ruby
gem "x-twitter-scraper", "~> 0.4.5"
gem "x-twitter-scraper", "~> 0.5.0"
```

<!-- x-release-please-end -->
Expand All @@ -46,29 +33,6 @@ paginated_tweets = x_twitter_scraper.x.tweets.search(q: "from:elonmusk", limit:
puts(paginated_tweets.has_next_page)
```

### File uploads

Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.

```ruby
require "pathname"

# Use `Pathname` to send the filename and avoid paging a large file into memory:
response = x_twitter_scraper.x.media.upload(file: Pathname("/path/to/file"))

# Alternatively, pass file contents or a `StringIO` directly:
response = x_twitter_scraper.x.media.upload(file: File.read("/path/to/file"))

# Or, control the filename and content type:
file =
XTwitterScraper::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")
response = x_twitter_scraper.x.media.upload(file: file)

puts(response.mediaId)
```

Passing a raw `IO` descriptor disables retries because pipes cannot be rewound safely.

### Handling errors

When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `XTwitterScraper::Errors::APIError` will be thrown:
Expand Down Expand Up @@ -204,7 +168,7 @@ Unless otherwise specified, other classes in the SDK do not have locks protectin

## Sorbet

This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.
The SDK includes [RBI](https://sorbet.org/docs/rbi) definitions. It does not depend on `sorbet-runtime`.

You can provide typesafe request parameters like so:

Expand Down Expand Up @@ -264,3 +228,5 @@ Ruby 3.2.0 or higher.
## Contributing

See [the contributing documentation](https://github.com/Xquik-dev/x-twitter-scraper-ruby/tree/main/CONTRIBUTING.md).

Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.
Loading