Skip to main content

Twitter search & user timeline components for Haystack

OpenSSF Best Practices

Search Twitter and fetch public user timelines in Haystack RAG pipelines. Each Xquik result becomes a Haystack Document.

Xquik is the world's fastest and cheapest X Twitter scraper service with the most complete X data. Xquik charges only for delivered, unique, filter-matching results and never pads rows.

Read the Xquik Haystack guide.

Components

Task Haystack Component Xquik Route Output
Search tweets for RAG XquikTweetSearch GET /x/tweets/search Matching posts as Document objects
Retrieve a user's timeline XquikUserTweetsFetcher GET /x/users/{id}/tweets Recent user posts as Document objects

Import both read-only components from the Haystack integration namespace.

from haystack_integrations.components.websearch.xquik import XquikTweetSearch, XquikUserTweetsFetcher

Both components read XQUIK_API_KEY by default and accept a Haystack Secret. They send x-api-key and xquik-api-contract: 2026-04-29 headers. Set base_url for another Xquik-compatible endpoint. Results include documents, links, has_more, and next_cursor.

Use an Xquik SDK for follower exports or posting.

Install

pip install xquik-haystack

Search posts

from haystack import Pipeline
from haystack.utils import Secret
from haystack_integrations.components.websearch.xquik import XquikTweetSearch

search = XquikTweetSearch(api_key=Secret.from_env_var("XQUIK_API_KEY"), top_k=10)

pipeline = Pipeline()
pipeline.add_component("x_search", search)

result = pipeline.run({"x_search": {"query": "haystack ai"}})
documents = result["x_search"]["documents"]

Fetch user posts

from haystack.utils import Secret
from haystack_integrations.components.websearch.xquik import XquikUserTweetsFetcher

fetcher = XquikUserTweetsFetcher(api_key=Secret.from_env_var("XQUIK_API_KEY"))

result = fetcher.run(user_id="example_user", include_replies=False)
documents = result["documents"]

Document mapping

Each tweet becomes a Haystack Document with this mapping.

  • Document.content holds the tweet text, or an empty string when text is missing.
  • Document.meta["endpoint"] names the Xquik endpoint family the component used.
  • Document.meta holds the available id, url, and created_at source values.
  • Document.meta["author"] holds the available author identity and verification data.
  • Document.meta holds the available like, repost, reply, quote, view & bookmark counts.

Development

Use Hatch for builds and environment management.

pip install hatch==1.18.0
hatch run fmt-check
hatch run test:unit
hatch build

Unit tests mock all Xquik HTTP calls.

Run bin/check-local before you open a pull request. It runs the lint, license, test & CodeQL checks.

Maintainers release with bin/release-local <version> on a clean main. It runs the checks, builds, uploads to PyPI, tags the commit and creates the GitHub release. bin/release-local --dry-run <version> uploads, tags and releases nothing.

PyPI has no trusted publisher for xquik-haystack. A maintainer's PyPI token is the only way it publishes. bin/release-local reads it from the Keychain item that PYPI_KEYCHAIN_SERVICE names.

Support & project policies

License

xquik-haystack is distributed under the terms of the Apache-2.0 license.

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

Metadata

Release files for xquik-haystack 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xquik-haystack 0.1.7
File Size Uploaded
xquik_haystack-0.1.7.tar.gz 32.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xquik-haystack 0.1.7
File Interpreter ABI Platform
xquik_haystack-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 43.7 kB

Release files / xquik_haystack-0.1.7.tar.gz

Download URL xquik_haystack-0.1.7.tar.gz
Size 32.7 kB
Tags Source
SHA-256 checksum
How to use checksums
39f60c3a0178d11e5760cda4948f08dcbd481b4cbe9ced07f2bffb2c6f046535
BLAKE2b-256 checksum
How to use checksums
d9166480593a71ab9b038d10c972b3c48e403aa11438d2bac3ff3db632d31904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / xquik_haystack-0.1.7-py3-none-any.whl

Download URL xquik_haystack-0.1.7-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1748a6f9ab65de4fd175b9f1192ee1993c0851c989e5464f8e622460c26e5352
BLAKE2b-256 checksum
How to use checksums
e9377830f9049035f236fba80a396550256ab32ebecdab3f190cc10cde61c6c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page