> For the complete documentation index, see [llms.txt](https://blackswanwtf.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://blackswanwtf.gitbook.io/docs/smart-agents/x-twitter-scraping-service.md).

# X (Twitter) Scraping Service

A high-performance microservice designed for continuous monitoring and collection of cryptocurrency-related tweets. It focuses on gathering data from specified Twitter accounts and token mentions, featuring advanced thread detection, intelligent deduplication, and robust error handling.

## Key Features

**Real-time Twitter Monitoring**\
Continuously monitors a configurable list of Twitter accounts and token-specific searches

**Advanced Thread Detection**\
Employs a sophisticated algorithm to automatically detect and consolidate multi-part tweet threads

**Intelligent Deduplication**\
Utilizes an in-memory cache and batch database queries to efficiently filter out duplicate tweets

**Token Mention Tracking**\
Specifically monitors tweets mentioning predefined cryptocurrency tokens (e.g., BTC, ETH)

**Consolidated Data Collections**\
Stores all collected tweets and threads into two primary database collections

**Optimized Memory Management**\
Includes automatic cache cleanup mechanisms to prevent memory bloat

## How It Works?

1. Tweets and threads scraped from a repository of accounts known to follow / post on latest crypto news or trends, official project accounts, news media outlets and crypto publications.
2. Tweets and threads scraped from token ticker searches and token contract address searches within the last 24 hours with a filtering based on likes and engagement on the posts.
3. Collected and appropriately tagged, stored and made available for use in further analysis in services / agents.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://blackswanwtf.gitbook.io/docs/smart-agents/x-twitter-scraping-service.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
