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: tweet text, or an empty string when text is missing
  • Document.meta["endpoint"]: Xquik endpoint family used by the component
  • Document.meta: available id, url, and created_at source values
  • Document.meta["author"]: available author identity and verification data
  • Document.meta: 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.6

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.6
File Size Uploaded
xquik_haystack-0.1.6.tar.gz 32.6 kB Details

Built distribution (wheel)

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

Total release size: 43.7 kB

Release files / xquik_haystack-0.1.6.tar.gz

Download URL xquik_haystack-0.1.6.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
278466c2288be380893a1ccd666cf0a0ffd4ee27f3eece29cbd000e0cc6c78e7
BLAKE2b-256 checksum
How to use checksums
4777e2b433560f4d670daea100ca84d954090f6695d9114f0945a40def74594d
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.6-py3-none-any.whl

Download URL xquik_haystack-0.1.6-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
514b58be54592e67632a91056152ebf0a95e7e18460bd1f638212881de46345f
BLAKE2b-256 checksum
How to use checksums
3dfd0e6531109301c6c174f1e87cd95405daa4671b05855abe86be7fb4e82b83
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

0.1.7

2 release files

This release

0.1.6 This release

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