# Bluesky Scraper 🦋 (`nocodeventure/bluesky-scraper`) Actor

Scrape Bluesky posts and DMs without the hassle. This Actor extracts posts, replies, and direct messages from Bluesky, fast, reliable.

- **URL**: https://apify.com/nocodeventure/bluesky-scraper.md
- **Developed by:** [No-Code Venture](https://apify.com/nocodeventure) (community)
- **Categories:** Automation, Social media, Integrations
- **Stats:** 29 total users, 3 monthly users, 99.6% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Bluesky Scraper 🦋

**Scrape Bluesky posts and DMs without the hassle.** Scrapes posts, replies, and direct messages from Bluesky — fast, reliable, and no browser automation needed.

### ✨ Features

- **🔍 Search Mode** – Search for posts by keyword across all of Bluesky
- **👤 User Feed Mode** – Scrape posts from any public Bluesky profile
- **💬 Reply Threads** – Extract full reply threads with configurable depth
- **📨 Direct Messages** – Scrape your private DM conversations (requires auth)
- **🖼️ Rich Content** – Extracts text, images, videos, external links, and quote posts
- **⚡ Fast & Lightweight** – Uses the AT Protocol API directly (no browser needed)
- **🔐 Authenticated** – Requires login with your credentials (app password)

### 🚀 Getting Started

#### 📖 Three Modes: Search, User Feed, or Messages

| Mode | When to Use | Required Fields |
|------|-------------|-----------------|
| **Search** | Find posts by keyword across Bluesky | `scrapeMode: posts`, `searchQuery`, auth |
| **User Feed** | Scrape posts from a specific user | `scrapeMode: posts`, `handle`, auth |
| **Messages** | Scrape your direct messages | `scrapeMode: messages`, auth |

> ⚠️ **Note:** All modes require authentication.

***

### 📝 Posts Mode

#### 🔍 Search for Posts

Search for posts by keyword across all of Bluesky.

```json
{
    "scrapeMode": "posts",
    "searchQuery": "artificial intelligence",
    "searchSort": "top",
    "postCount": 20
}
```

**Search Sort Options:**

- `top` – Most relevant/popular results (default)
- `latest` – Most recent posts first

***

#### 👤 Scrape User Feed

Scrape posts from a specific Bluesky user's profile.

```json
{
    "scrapeMode": "posts",
    "handle": "apify.com",
    "feedFilter": "posts_and_author_threads",
    "postCount": 25
}
```

**Feed Filter Options:**

| Filter | Description |
|--------|-------------|
| `posts_and_author_threads` | Posts + conversation threads (default) |
| `posts_no_replies` | Only original posts, no replies |
| `posts_with_replies` | Posts including replies to others |
| `posts_with_media` | Only posts with images/videos |

***

#### 💬 Including Reply Threads

Enable `includeReplies` to fetch the full reply thread for each post:

```json
{
    "scrapeMode": "posts",
    "handle": "jay.bsky.team",
    "postCount": 10,
    "includeReplies": true,
    "repliesDepth": 3
}
```

***

### 📨 Messages Mode (DMs)

Scrape your direct message conversations. **Requires authentication.**

```json
{
    "scrapeMode": "messages",
    "conversationCount": 10,
    "messagesPerConversation": 50,
    "unreadOnly": false,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

**Message Options:**

| Parameter | Description | Default |
|-----------|-------------|---------|
| `conversationCount` | Number of conversations to fetch (0 = all) | `10` |
| `messagesPerConversation` | Messages per conversation (0 = all) | `50` |
| `unreadOnly` | Only fetch conversations with unread messages | `false` |

***

### 📋 JSON Examples for All Use Cases

#### 1. Search Posts - Basic

Find posts about a topic (authentication required):

```json
{
    "scrapeMode": "posts",
    "searchQuery": "web scraping",
    "postCount": 10,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 2. Search Posts - Latest

Get the latest posts:

```json
{
    "scrapeMode": "posts",
    "searchQuery": "breaking news",
    "searchSort": "latest",
    "postCount": 50,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 3. Search Posts - With Reply Threads

Search and get all reply threads:

```json
{
    "scrapeMode": "posts",
    "searchQuery": "controversial topic",
    "searchSort": "top",
    "postCount": 20,
    "includeReplies": true,
    "repliesDepth": 5,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 4. User Feed - All Post Types

Get all posts from a user (posts + threads):

```json
{
    "scrapeMode": "posts",
    "handle": "apify.com",
    "feedFilter": "posts_and_author_threads",
    "postCount": 100
}
```

#### 5. User Feed - Original Posts Only

Get only original posts (no replies to others):

```json
{
    "scrapeMode": "posts",
    "handle": "jay.bsky.team",
    "feedFilter": "posts_no_replies",
    "postCount": 50
}
```

#### 6. User Feed - Media Only

Get only posts with images/videos:

```json
{
    "scrapeMode": "posts",
    "handle": "photography.bsky.social",
    "feedFilter": "posts_with_media",
    "postCount": 30
}
```

#### 7. User Feed - With All Replies

Get posts including all replies to other users:

```json
{
    "scrapeMode": "posts",
    "handle": "influencer.bsky.social",
    "feedFilter": "posts_with_replies",
    "postCount": 100,
    "includeReplies": true,
    "repliesDepth": 0
}
```

#### 8. User Feed - Unlimited Posts

Get ALL posts from a user (0 = unlimited):

```json
{
    "scrapeMode": "posts",
    "handle": "active-user.bsky.social",
    "feedFilter": "posts_and_author_threads",
    "postCount": 0,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 9. Direct Messages - Basic

Get your recent DM conversations:

```json
{
    "scrapeMode": "messages",
    "conversationCount": 10,
    "messagesPerConversation": 50,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 10. Direct Messages - Unread Only

Get only conversations with unread messages:

```json
{
    "scrapeMode": "messages",
    "conversationCount": 0,
    "messagesPerConversation": 20,
    "unreadOnly": true,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 11. Direct Messages - Full Backup

Export ALL conversations with ALL messages:

```json
{
    "scrapeMode": "messages",
    "conversationCount": 0,
    "messagesPerConversation": 0,
    "unreadOnly": false,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 12. Brand Monitoring

Track mentions of your brand:

```json
{
    "scrapeMode": "posts",
    "searchQuery": "\"your brand name\"",
    "searchSort": "latest",
    "postCount": 100,
    "includeReplies": true,
    "repliesDepth": 2,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

#### 13. Competitor Analysis

Monitor competitor's posts:

```json
{
    "scrapeMode": "posts",
    "handle": "competitor.bsky.social",
    "feedFilter": "posts_no_replies",
    "postCount": 50,
    "includeReplies": true,
    "repliesDepth": 3
}
```

#### 14. Hashtag/Topic Research

Find posts about a specific hashtag or topic:

```json
{
    "scrapeMode": "posts",
    "searchQuery": "#buildinpublic",
    "searchSort": "top",
    "postCount": 100,
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

***

### 🔑 Authentication

Authentication is **required for all operations**.

```json
{
    "blueskyIdentifier": "your-handle.bsky.social",
    "blueskyPassword": "your-app-password"
}
```

> ⚠️ **Important:** Use an **App Password**, not your main account password!
>
> Create one at: **Settings → App Passwords → Add App Password**

***

### Input Parameters

#### Mode Selection

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `scrapeMode` | String | What to scrape: `posts` or `messages` | `posts` |

#### Posts Mode Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `searchQuery` | String | Search term (enables search mode) | — |
| `searchSort` | String | Sort: `top`, `latest` | `top` |
| `handle` | String | User handle without "@" | — |
| `feedFilter` | String | Feed filter type | `posts_and_author_threads` |
| `postCount` | Integer | Posts to scrape (0 = all) | `10` |
| `includeReplies` | Boolean | Fetch reply threads | `false` |
| `repliesDepth` | Integer | Reply thread depth (0 = all) | `2` |

#### Messages Mode Parameters

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `conversationCount` | Integer | Conversations to fetch (0 = all) | `10` |
| `messagesPerConversation` | Integer | Messages per convo (0 = all) | `50` |
| `unreadOnly` | Boolean | Only unread conversations | `false` |

#### Authentication

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `blueskyIdentifier` | String | Your handle or email | — |
| `blueskyPassword` | String | Your app password | — |

#### Protocol Settings

| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| `service` | String | AT Protocol service URL (for alternative PDS servers) | `https://bsky.social` |

***

### 📊 Output Examples

#### Post Output

```json
{
    "uri": "at://did:plc:xxx/app.bsky.feed.post/yyy",
    "cid": "bafyrei...",
    "text": "Just launched our new web scraping platform! 🚀",
    "author": "Apify",
    "authorHandle": "apify.com",
    "authorDid": "did:plc:vu5ic5ygdeyunpefgmlamsmw",
    "authorAvatar": "https://cdn.bsky.app/img/avatar/...",
    "createdAt": "2024-01-15T10:30:00.000Z",
    "likeCount": 142,
    "repostCount": 28,
    "replyCount": 15,
    "quoteCount": 5,
    "url": "https://bsky.app/profile/apify.com/post/yyy",
    "embed": {
        "type": "images",
        "images": [
            {
                "url": "https://cdn.bsky.app/img/feed_fullsize/...",
                "alt": "Screenshot of the new platform"
            }
        ]
    },
    "replies": [
        {
            "uri": "at://did:plc:abc/app.bsky.feed.post/zzz",
            "text": "This looks amazing!",
            "author": "TechEnthusiast",
            "authorHandle": "techlover.bsky.social",
            "likeCount": 8,
            "depth": 1
        }
    ]
}
```

#### DM Output

```json
{
    "conversation": {
        "id": "3abc123...",
        "members": [
            {
                "did": "did:plc:xxx",
                "handle": "friend.bsky.social",
                "displayName": "Friend Name",
                "avatar": "https://cdn.bsky.app/..."
            }
        ],
        "lastMessage": {
            "id": "msg123",
            "text": "Hey, how's it going?",
            "sender": "did:plc:xxx",
            "sentAt": "2024-01-15T10:30:00.000Z"
        },
        "unreadCount": 0,
        "muted": false
    },
    "messages": [
        {
            "id": "msg123",
            "text": "Hey, how's it going?",
            "sender": {
                "did": "did:plc:xxx",
                "handle": "friend.bsky.social",
                "displayName": "Friend Name"
            },
            "sentAt": "2024-01-15T10:30:00.000Z",
            "conversationId": "3abc123..."
        }
    ]
}
```

#### Embed Types

| Type | Description | Fields |
|------|-------------|--------|
| `images` | One or more images | `images[].url`, `images[].alt` |
| `video` | Video content | `video.url`, `video.thumbnail` |
| `external` | Link preview | `external.uri`, `external.title`, `external.description` |
| `quote` | Quote post | `record.uri`, `record.cid`, `record.text` |

***

### 🎯 Use Cases

#### Posts

- **Brand Monitoring** – Track mentions of your company or product
- **Market Research** – Analyze trends and sentiment
- **Content Curation** – Find popular posts for content ideas
- **Competitor Analysis** – Monitor competitor activity

#### Direct Messages

- **Backup DMs** – Export your conversation history
- **Message Analytics** – Analyze your communication patterns
- **Data Migration** – Move conversations to another platform
- **Research** – Study DM patterns (with consent)

***

### ⚙️ How It Works

1. **Initialize** – Creates a connection to Bluesky's API
2. **Authenticate** (if provided) – Logs in for DM access or higher rate limits
3. **Fetch** – Retrieves posts via search/feed or DMs via chat API
4. **Process** – Extracts replies or messages as configured
5. **Output** – Saves structured data to the dataset

### 🛡️ Rate Limits

| Status | Approximate Limits |
|--------|-------------------|
| **Authenticated** | ~3000 requests/minute |

### 💡 Tips

- **App passwords** – Always use app passwords, never your main password
- **Start small** – Test with small counts before scaling
- **Feed filters** – Use `posts_no_replies` for cleaner original content
- **Search tips** – Use quotes for exact phrases: `"machine learning"`
- **Alternative PDS** – If your account is on a self-hosted PDS, set the `service` parameter

### 📜 Legal & Ethical Use

This Actor scrapes Bluesky's. Please:

- Respect Bluesky's Terms of Service
- Don't share or expose private messages
- Use reasonable rate limits
- Comply with data protection laws

### 🤝 Support

Having issues? Found a bug? Want a feature?

- Open an issue on the Actor's page
- Contact the developer through Apify

***

**Built by [nocodeventure](https://apify.com/nocodeventure)** • Made with 💙 for the Apify community

# Actor input Schema

## `scrapeMode` (type: `string`):

What to scrape from Bluesky.

## `searchQuery` (type: `string`):

Search term to find posts on Bluesky. Leave empty to scrape from a specific user's feed instead.

## `searchSort` (type: `string`):

How to sort search results.

## `handle` (type: `string`):

The Bluesky handle to scrape posts from (e.g., 'apify.com', 'jay.bsky.team'). Don't include '@'. Leave empty if using search mode.

## `feedFilter` (type: `string`):

What type of content to get from the user's feed.

## `postCount` (type: `integer`):

Number of posts to extract. Set to 0 to get all available posts (up to API limits).

## `includeReplies` (type: `boolean`):

When enabled, fetches the full reply thread for each post. This makes additional API calls per post.

## `repliesDepth` (type: `integer`):

Maximum depth of reply threads to fetch (0 = all replies). Only applies when 'Include Reply Threads' is enabled.

## `conversationCount` (type: `integer`):

Number of DM conversations to fetch. Set to 0 to get all conversations.

## `messagesPerConversation` (type: `integer`):

Maximum messages to fetch per conversation. Set to 0 for all messages.

## `unreadOnly` (type: `boolean`):

When enabled, only fetches conversations with unread messages.

## `blueskyIdentifier` (type: `string`):

Your Bluesky handle or email for authentication. Required for all operations.

## `blueskyPassword` (type: `string`):

Your Bluesky app password. Create one at Settings > App Passwords. Do NOT use your main account password.

## `service` (type: `string`):

The AT Protocol service URL to authenticate against. Only change this if your account is hosted on a different PDS (Personal Data Server) than the default Bluesky server.

## Actor input object example

```json
{
  "scrapeMode": "posts",
  "searchSort": "top",
  "handle": "apify.com",
  "feedFilter": "posts_and_author_threads",
  "postCount": 10,
  "includeReplies": false,
  "repliesDepth": 2,
  "conversationCount": 10,
  "messagesPerConversation": 50,
  "unreadOnly": false,
  "service": "https://bsky.social"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "handle": "apify.com",
    "postCount": 10,
    "repliesDepth": 2,
    "conversationCount": 10,
    "messagesPerConversation": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("nocodeventure/bluesky-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "handle": "apify.com",
    "postCount": 10,
    "repliesDepth": 2,
    "conversationCount": 10,
    "messagesPerConversation": 50,
}

# Run the Actor and wait for it to finish
run = client.actor("nocodeventure/bluesky-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "handle": "apify.com",
  "postCount": 10,
  "repliesDepth": 2,
  "conversationCount": 10,
  "messagesPerConversation": 50
}' |
apify call nocodeventure/bluesky-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=nocodeventure/bluesky-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/cLQ5tozib5VkhrtPn/builds/0YUDL0LNvWljRtqD4/openapi.json
