Skip to main content

Scrape and analyze websites with custom prompts using Gemini, Apify, and LangChain

Workflow preview

Workflow preview
100%
Scrape and analyze websites with custom prompts using Gemini, Apify, and LangChain preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

AI Powered Website Prompt Executor (Apify + OpenRouter) This workflow combines the power of Apify and OpenRouter to scrape website content and execu...

Best for

  • Document Extraction automation workflows
  • AI RAG automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.httprequest, n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenrouter, n8n-nodes-base.aggregate, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Msaid Mohamed el hadi.

Original n8n.io source

1.1 Workflow description

Title
Scrape and analyze websites with custom prompts using Gemini, Apify, and LangChain
Workflow name
Scrape and analyze websites with custom prompts using Gemini, Apify, and LangChain

๐Ÿ” AI-Powered Website Prompt Executor (Apify + OpenRouter)

This workflow combines the power of Apify and OpenRouter to scrape website content and execute any custom prompt using AI. You define what you want โ€” whether itโ€™s extracting contact details, summarizing content, collecting job offers, or anything else โ€” and the system intelligently processes the site to give you results.

๐Ÿš€ Overview

This workflow allows you to:

  1. Input a URL and define a prompt.
  2. Scrape the specified number of pages from the website.
  3. Process each pageโ€™s metadata and Markdown content.
  4. Use AI to interpret and respond to the prompt on each page.
  5. Aggregate and return structured output.

๐Ÿง  How It Works

Input Example

{
  "enqueue": true,
  "maxPages": 5,
  "url": "https://apify.com",
  "method": "GET",
  "prompt": "collect all contact informations available on this website"
}

Workflow Steps

Step Action
1 Triggered by another workflow with JSON input.
2 Calls the Apify actor firescraper-ai-website-content-markdown-scraper to scrape content.
3 Loops through the scraped pages.
4 AI analyzes each page based on the input prompt.
5 Aggregates AI outputs across all pages.
6 Final AI processing step to return a clean structured result.

๐Ÿ›  Technologies Used

  • Apify โ€“ Scrapes structured content and Markdown from websites.
  • OpenRouter โ€“ Provides access to advanced AI models like Gemini.
  • LangChain โ€“ Handles AI agent orchestration and prompt interpretation.

๐Ÿ”ง Customization

Customize the workflow via the following input fields:

  • url: Starting point for scraping
  • maxPages: Limit the number of pages to crawl
  • prompt: Define any instruction (e.g., โ€œsummarize this website,โ€ โ€œextract product data,โ€ โ€œlist all emails,โ€ etc.)

This allows dynamic, flexible use across various use cases.


๐Ÿ“ฆ Output

The workflow returns a JSON result that includes:

  • Processed prompt responses from each page
  • Aggregated AI insights
  • Structured and machine-readable format

๐Ÿงช Example Use Cases

  • ๐Ÿ” Extracting contact information from websites
  • ๐Ÿ“„ Summarizing articles or company profiles
  • ๐Ÿ›๏ธ Collecting product information
  • ๐Ÿ“‹ Extracting job listings or news
  • ๐Ÿ“ฌ Generating outreach lists from public data
  • ๐Ÿค– Used as a tool within other AI agents for real-time web analysis
  • ๐Ÿงฉ Integrated as an external tool in MCP (Multi-Component Prompt) servers to enhance AI capabilities

๐Ÿ” API Credentials Required

You will need:

  • Apify API token โ€“ For running the scraper actor
  • OpenRouter API key โ€“ For AI-powered prompt processing

Set these credentials in your environment or n8n credential manager before running.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 2 - HTTP Request

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 3 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 4 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 5 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 6 - AI Agent1

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 7 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 8 - OpenRouter Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 9 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Scrape and analyze websites with custom prompts using Gemini, Apify, and LangChain
Complexity intermediate
Nodes 9
Categories Document Extraction, AI RAG
Author Msaid Mohamed el hadi
Published 31 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6754/6754.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Scrape and analyze websites with custom prompts using Gemini, Apify, and LangChain do?

AI Powered Website Prompt Executor (Apify + OpenRouter) This workflow combines the power of Apify and OpenRouter to scrape website content and execu...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI RAG use case.