# BlueSky Feed Scraper (`harvest/bluesky-feed-scraper`) Actor

Scrapes data from a specified BlueSky feed URL and outputs detailed information about the posts, including metadata, authors, embedded media, and statistics such as likes, replies, and reposts.

- **URL**: https://apify.com/harvest/bluesky-feed-scraper.md
- **Developed by:** [Harvest Data](https://apify.com/harvest) (community)
- **Categories:** Social media, Integrations, Automation
- **Features:** Limited permissions
- **Stats:** 43 total users, 1 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 3.87 out of 5 stars

## Pricing

$2.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.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Bluesky Feed Scraper for Apify

This is an **Apify actor** that scrapes data from a specified Bluesky feed URL and outputs detailed information about the posts, including metadata, authors, embedded media, and statistics such as likes, replies, and reposts.

### Features

- Scrapes Bluesky feed posts from a given feed URL.
- Extracts detailed post data, including:
  - Author details (DID, handle, display name, avatar URL, etc.).
  - Post text, tags, and languages.
  - Embedded images, with metadata (alt text, aspect ratio, URLs).
  - Engagement statistics (likes, replies, reposts, quotes).
  - Thread and reply information.
  - Record metadata, including creation and indexing timestamps.

### Input

The actor requires the following input:

| Field         | Type   | Description                                   |
|---------------|--------|-----------------------------------------------|
| `url`     | String | The URL of the Bluesky feed you want to scrape. Example: `https://bsky.app/profile/username/feed`. |

#### Example Input

```json
{
  "url": "https://bsky.app/profile/c3rmen.bsky.social/feed"
}
```

### Output

The actor produces a JSON array where each object represents a post from the feed. The structure includes:

- `uri` and `cid`: Unique identifiers for the post.
- `author`: Details about the author (DID, handle, avatar, etc.).
- `record`: Post text, tags, languages, and embedded media.
- `embed`: View-ready image metadata (e.g., thumbnails, full-size URLs).
- Engagement metrics (`replyCount`, `repostCount`, `likeCount`, `quoteCount`).
- Thread and reply-related data.
- Timestamps (`createdAt`, `indexedAt`).

#### Example Output

```json
[
  {
    "uri": "at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.post/3lbsizxfxa22r",
    "cid": "bafyreifohcetdw6e5mudaz6anigzsm5ssjpm3oreyxu4a2l665k7hpxo4q",
    "author": {
      "did": "did:plc:z72i7hdynmk6r22z27h6tvur",
      "handle": "bsky.app",
      "displayName": "Bluesky",
      "avatar": "https://cdn.bsky.app/img/avatar/plain/did:plc:z72i7hdynmk6r22z27h6tvur/bafkreihagr2cmvl2jt4mgx3sppwe2it3fwolkrbtjrhcnwjk4jdijhsoze@jpeg",
      "associated": {
        "chat": {
          "allowIncoming": "none"
        }
      },
      "labels": [],
      "createdAt": "2023-04-12T04:53:57.057Z"
    },
    "record": {
      "createdAt": "2024-11-25T21:52:30.840Z",
      "embed": {
        "external": {
          "description": "Bluesky is social media as it should be. Find your community among millions of users, unleash your creativity, and have some fun again. https://bsky.app",
          "thumb": {
            "ref": {
              "$link": "bafkreihh7dthuxfqel6zwcmxapcu47tr34rat7thjtxlfmrwidvxfsmqne"
            },
            "mimeType": "image/jpeg",
            "size": 384236,
            "$type": "blob"
          },
          "title": "BlueskySocial - Twitch",
          "uri": "https://www.twitch.tv/blueskysocial"
        },
        "$type": "app.bsky.embed.external"
      },
      "facets": [
        {
          "features": [
            {
              "did": "did:plc:qjeavhlw222ppsre4rscd3n2",
              "$type": "app.bsky.richtext.facet#mention"
            }
          ],
          "index": {
            "byteEnd": 55,
            "byteStart": 40
          },
          "$type": "app.bsky.richtext.facet"
        },
        {
          "features": [
            {
              "did": "did:plc:ragtjsm2j2vknwkz3zp4oxrd",
              "$type": "app.bsky.richtext.facet#mention"
            }
          ],
          "index": {
            "byteEnd": 76,
            "byteStart": 64
          },
          "$type": "app.bsky.richtext.facet"
        },
        {
          "features": [
            {
              "did": "did:plc:4ewnpnebeh7zuk5pbardaxqz",
              "$type": "app.bsky.richtext.facet#mention"
            }
          ],
          "index": {
            "byteEnd": 226,
            "byteStart": 203
          },
          "$type": "app.bsky.richtext.facet"
        }
      ],
      "langs": [
        "en"
      ],
      "text": "Join us for another livestream with COO @rose.bsky.team and CTO @pfrazee.com, where they'll share team updates, the story of how Bluesky began, and what’s next. \n\nPlus, a special guest appearance from @flavorflav.bsky.social! 🎉\n\nToday 11/25 @ 5 pm PT / 8 pm ET / 1 am GMT / 10am JST",
      "$type": "app.bsky.feed.post"
    },
    "embed": {
      "external": {
        "uri": "https://www.twitch.tv/blueskysocial",
        "title": "BlueskySocial - Twitch",
        "description": "Bluesky is social media as it should be. Find your community among millions of users, unleash your creativity, and have some fun again. https://bsky.app",
        "thumb": "https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:z72i7hdynmk6r22z27h6tvur/bafkreihh7dthuxfqel6zwcmxapcu47tr34rat7thjtxlfmrwidvxfsmqne@jpeg"
      },
      "$type": "app.bsky.embed.external#view"
    },
    "replyCount": 324,
    "repostCount": 1041,
    "likeCount": 9147,
    "quoteCount": 84,
    "indexedAt": "2024-11-25T21:52:35.058Z",
    "labels": []
  },
  // ...more posts
]
```

### Usage

1. **Deploy the Actor**: Use the Apify console to set up and deploy this actor.
2. **Provide Input**: Supply the `url` in the input configuration.
3. **Run the Actor**: Start the actor, and it will scrape the feed URL and return the posts as JSON.

### Notes

- Ensure the `url` is publicly accessible.
- The actor fetches only visible posts; private or restricted feeds will not be included.

Feel free to suggest additional features or report any issues! 🚀

# Actor input Schema

## `url` (type: `string`):

The URL of feed you want to scrape posts from.

## `limit` (type: `integer`):

The upper limit of number of posts to scrape. If the feed contains less than this limit, all posts will be scraped.

## Actor input object example

```json
{
  "url": "https://bsky.app/profile/bsky.app/feed/bsky-team",
  "limit": 10000
}
```

# 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 = {
    "url": "https://bsky.app/profile/bsky.app/feed/bsky-team",
    "limit": 10000
};

// Run the Actor and wait for it to finish
const run = await client.actor("harvest/bluesky-feed-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 = {
    "url": "https://bsky.app/profile/bsky.app/feed/bsky-team",
    "limit": 10000,
}

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

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

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

```

## CLI example

```bash
echo '{
  "url": "https://bsky.app/profile/bsky.app/feed/bsky-team",
  "limit": 10000
}' |
apify call harvest/bluesky-feed-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,harvest/bluesky-feed-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/hTc7aamrw7AVxwUDj/builds/nxwednNRlVTmgM3LQ/openapi.json
