# Lobsters Scraper (`epctex/lobsters-scraper`) Actor

Scrape Lobste.rs posts and users based on any search criteria. Retrieve all the comments, domains, tags, titles, number of upvotes, and published dates. Use this extremely fast actor to retrieve all the information right away. Easy use and no limits!

- **URL**: https://apify.com/epctex/lobsters-scraper.md
- **Developed by:** [epctex](https://apify.com/epctex) (community)
- **Categories:** News
- **Stats:** 4 total users, 1 monthly users, 100.0% runs succeeded, 9 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$10.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

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

## Actor - Lobsters Scraper

### Lobsters scraper

Since Lobste.rs doesn't provide a good and free API, this actor should help you to retrieve data from it.

The Lobsters data scraper supports the following features:

- Search any keyword - You can search any keyword you would like to have and get the results

- Scrape domains - Get all the posts from each of the domains that are represented in lobste.rs.

- Get posts by tags - Scraping the results by a certain tag is doable!

- Retrieve user detail - If you are looking for specific user details, you are in the right place.

- Fetch comments of any post - All the comments that have been shared under a post are also included inside the search results.

- Get active and recent posts - Don't get outdated! Active and recent posts can be harvested right away from the Lobsters.

### Bugs, fixes, updates, and changelog

This scraper is under active development. If you have any feature requests you can create an issue from [here](https://github.com/epctex-support/lobsters-scraper/issues).

### Upcoming Features

- Integrate hierarchical comment tree structure.

### Input Parameters

The input of this scraper should be JSON containing the list of pages on Lobsters that should be visited. Possible fields are:

- `search`: (Optional) (String) Keyword that you want to search on Lobsters.

- `startUrls`: (Optional) (Array) List of Lobsters URLs. You should only provide domains, tags, user detail, post detail, active posts, recent posts, or search URLs.

- `endPage`: (Optional) (Number) Final number of page that you want to scrape. The default is `Infinite`. This applies to all `search` requests and `startUrls` individually.

- `maxItems`: (Optional) (Number) You can limit scraped items. This should be useful when you search through the big lists or search results.

- `proxy`: (Required) (Proxy Object) Proxy configuration.

- `extendOutputFunction`: (Optional) (String) Function that takes a JQuery handle ($) as an argument and returns an object with data.

- `customMapFunction`: (Optional) (String) Function that takes each object's handle as an argument and returns the object with executing the function.

This solution requires the use of **Proxy servers**, either your own proxy servers or you can use [Apify Proxy](https://www.apify.com/docs/proxy).

#### Tip

When you want to scrape over a specific list URL, just copy and paste the link as one of the **startUrl**.

If you would like to scrape only the first page of a list then put the link for the page and have the `endPage` as 1.

With the last approach that is explained above you can also fetch any interval of pages. If you provide the 5th page of a list and define the `endPage` parameter as 6 then you'll have the 5th and 6th pages only.

#### Compute Unit Consumption

The actor is optimized to run blazing fast and scrape as many items as possible. Therefore, it forefronts all the detailed requests. If the actor doesn't block very often it'll scrape 100 listings in 30 seconds with ~0.01-0.02 compute units.

#### Lobsters Scraper Input example

```json
{
 "startUrls": [
  "https://lobste.rs/domains/google.com",
  "https://lobste.rs/t/devops",
  "https://lobste.rs/u/lambda",
  "https://lobste.rs/active",
  "https://lobste.rs/recent",
  "https://lobste.rs/search?q=google&what=stories&order=newest"
 ],
 "maxItems":10,
 "endPage":2,
  "proxy":{
    "useApifyProxy":true
  }
}

```

### During the Run

During the run, the actor will output messages letting you know what is going on. Each message always contains a short label specifying which page from the provided list is currently specified.
When items are loaded from the page, you should see a message about this event with a loaded item count and total item count for each page.

If you provide incorrect input to the actor, it will immediately stop with a failure state and output an explanation of what is wrong.

### Lobsters Export

During the run, the actor stores results into a dataset. Each item is a separate item in the dataset.

You can manage the results in any language (Python, PHP, Node JS/NPM). See the FAQ or <a href="https://www.apify.com/docs/api" target="blank">our API reference</a> to learn more about getting results from this Lobsters actor.

### Scraped Lobsters Properties

The structure of each item in Lobsters looks like this:

#### User Detail

```json
{
	"type": "user",
	"name": "lambda",
	"url": "https://lobste.rs/u/lambda",
	"avatar": "https://lobste.rs/avatars/lambda-100.png",
	"status": "Active user",
	"homepage": "https://maxcountryman.com",
	"github": "https://github.com/maxcountryman",
	"about": "Indie hacker and people-first leader. Building https://remotejobs.com in public on Twitter.",
	"joinedAt": "2013-12-30 09:46:46 -0600",
	"karma": "392",
	"numberOfComments": "10",
	"numberOfStories": "28"
}
```

#### Post Detail

```json
{
    "type": "post",
    "id": "kour63",
    "url": "https://lobste.rs/s/kour63/help_test_cargo_s_new_index_protocol",
    "title": "Help test Cargo's new index protocol",
    "link": "https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html",
    "numberOfUpvotes": 13,
    "userName": "icefox",
    "userLink": "https://lobste.rs/u/icefox",
    "domain": "blog.rust-lang.org",
    "date": "2023-03-09 12:24:32 -0600",
    "tags": [
        "devops",
        "rust"
    ],
    "comments": [
        {
            "id": "dudcdn",
            "body": "Rust 1.68.0 has been released so this is now usable in stable Rust too. Still opt-in though. https://blog.rust-lang.org/2023/03/09/Rust-1.68.0.html",
            "numberOfUpvotes": 3,
            "date": "2023-03-09 16:48:32 -0600",
            "userLink": "https://lobste.rs/u/wezm",
            "userName": "wezmlink"
        }
    ]
}
```

### Contact

Please visit us through [epctex.com](https://epctex.com) to see all the products that are available for you. If you are looking for any custom integration or so, please reach out to us through the chat box in [epctex.com](https://epctex.com). In need of support? <business@epctex.com> is at your service.

# Actor input Schema

## `startUrls` (type: `array`):

URLs to start with. It should be tag, domain, user, search or detail URL

## `search` (type: `string`):

The keyword that you can search on lobste.rs

## `maxItems` (type: `integer`):

Maximum number of listing items that you want as output. Default is all

## `endPage` (type: `integer`):

The page number that you want to end with. By default there is no end page. This is applies to all search request and startUrls individually.

## `extendOutputFunction` (type: `string`):

Function that takes a JQuery handle ($) as argument and returns data that will be merged with the default output

## `customMapFunction` (type: `string`):

Function that takes each of the objects as argument and returns data that will be mapped by the function itself.

## `proxy` (type: `object`):

Select proxies to be used by your crawler.

## Actor input object example

```json
{
  "startUrls": [
    "https://lobste.rs/domains/google.com",
    "https://lobste.rs/t/devops",
    "https://lobste.rs/u/lambda",
    "https://lobste.rs/active",
    "https://lobste.rs/recent",
    "https://lobste.rs/search?q=google&what=stories&order=newest"
  ],
  "maxItems": 20,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "customMapFunction": "(object) => { return {...object} }",
  "proxy": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "startUrls": [
        "https://lobste.rs/domains/google.com",
        "https://lobste.rs/t/devops",
        "https://lobste.rs/u/lambda",
        "https://lobste.rs/active",
        "https://lobste.rs/recent",
        "https://lobste.rs/search?q=google&what=stories&order=newest"
    ],
    "maxItems": 20,
    "endPage": 1,
    "extendOutputFunction": ($) => { return {} },
    "customMapFunction": (object) => { return {...object} },
    "proxy": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("epctex/lobsters-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 = {
    "startUrls": [
        "https://lobste.rs/domains/google.com",
        "https://lobste.rs/t/devops",
        "https://lobste.rs/u/lambda",
        "https://lobste.rs/active",
        "https://lobste.rs/recent",
        "https://lobste.rs/search?q=google&what=stories&order=newest",
    ],
    "maxItems": 20,
    "endPage": 1,
    "extendOutputFunction": "($) => { return {} }",
    "customMapFunction": "(object) => { return {...object} }",
    "proxy": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("epctex/lobsters-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 '{
  "startUrls": [
    "https://lobste.rs/domains/google.com",
    "https://lobste.rs/t/devops",
    "https://lobste.rs/u/lambda",
    "https://lobste.rs/active",
    "https://lobste.rs/recent",
    "https://lobste.rs/search?q=google&what=stories&order=newest"
  ],
  "maxItems": 20,
  "endPage": 1,
  "extendOutputFunction": "($) => { return {} }",
  "customMapFunction": "(object) => { return {...object} }",
  "proxy": {
    "useApifyProxy": true
  }
}' |
apify call epctex/lobsters-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

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