Skip to main content

Documentation Index

Fetch the complete documentation index at: https://help.decodo.com/llms.txt

Use this file to discover all available pages before exploring further.

A Decodo Node.js LangChain plugin that enables developers to use Decodo’s Scraper API alongside their LangChain applications. Decodo Lanchain Tool integration is available with any Web Scraping API plan.
More information can be found on GitHub here.

Features

  • Web Scraping: Scrape any URL
  • Google Search: Search Google and retrieve structured results
  • Amazon Search: Search Amazon and retrieve structured product data
  • Reddit Scraping: Scrape Reddit posts and subreddits
  • Full TypeScript Support: Complete type definitions for all parameters
  • LangChain Integration: Seamless integration with LangChain’s Tool system

Quick start

Prerequisites

  • Node.js >= v20
Installation:
npm install @decodo/langchain-ts
Once you have an Advanced plan activated, take a note of your generated username and password:
  1. Clone this repo and install dependencies
git clone [email protected]:Decodo/decodo-langchain-ts.git
cd decodo-langchain-ts
npm i
  1. Run any of the sample agents
npm run example:agent-universal
npm run example:agent-google
npm run example:agent-amazon
A simple agentic example:
import dotenv from 'dotenv';
import { ChatOpenAI } from '@langchain/openai';
import { createReactAgent } from '@langchain/langgraph/prebuilt';
import { DecodoUniversalTool } from '@decodo/langchain-ts';

dotenv.config();

const main = async () => {
  const username = process.env.SCRAPER_API_USERNAME!;
  const password = process.env.SCRAPER_API_PASSWORD!;

  const decodoUniversalTool = new DecodoUniversalTool({ username, password });

  const model = new ChatOpenAI({
    model: 'gpt-4o-mini',
  });

  const agent = createReactAgent({
    llm: model,
    tools: [decodoUniversalTool],
  });

  const result = await agent.invoke({
    messages: [
      {
        role: 'user',
        content: 'scrape the wikipedia NBA 2025 season page and tell me who won in 2025?',
      },
    ],
  });

  console.log(result.messages[result.messages.length - 1].content);
};

if (require.main === module) {
  main();
}
All tools accept a DecodoConfig object:
type DecodoConfig = {
  username: string; // Your Web Advanced product username
  password: string; // Your Web Advanced product password
};

Parameters

Web Scraping:
ParameterRequiredDescription
urlWebsite URL
geoThe geographical location on which the result depends. Read more.
JsRenderWhen set to true, enables javascript rendering
markdownWhen set to true, returns markdown response
Google Search:
ParameterRequiredDescription
querySearch query
parseAutomatically parses results when set to true
geoThe geographical location on which the result depends. Read more.
JsRenderWhen set to true, enables javascript rendering.
Amazon Search:
ParameterRequiredDescription
querySearch query
parseAutomatically parses results when set to true
geoThe geographical location on which the result depends. Read more.
JsRenderWhen set to true, enables javascript rendering.
Reddit Scraping:
ParameterRequiredDescription
urlReddit subreddit URL
geoThe geographical location on which the result depends. Read more
parseAutomatically parses results when set to true

Support

Need help or just want to say hello? Our support is available 24/7.
You can also reach us anytime via email at support@decodo.com.

Feedback

Can’t find what you’re looking for? Request an article!
Have feedback? Share your thoughts on how we can improve.