Skip to main content

Overview

Jina Reader API converts any URL into clean, LLM-ready text. It handles JavaScript rendering, removes ads, and extracts the main content.

Installation

pip install "praisonai[tools]"

Environment Variables

export JINA_API_KEY=your_api_key_here  # Optional - works without key with limits
Get your API key from Jina AI.

Quick Start

from praisonai_tools import JinaTool

# Initialize
jina = JinaTool()

# Read a URL
content = jina.read("https://example.com")
print(content)

Usage with Agent

from praisonaiagents import Agent
from praisonai_tools import JinaTool

agent = Agent(
    name="Reader",
    instructions="You are a content reader. Use Jina to extract content from URLs.",
    tools=[JinaTool()]
)

response = agent.chat("Read the content from https://docs.praison.ai")
print(response)

Available Methods

read(url)

Read and extract content from a URL.
from praisonai_tools import JinaTool

jina = JinaTool()
result = jina.read("https://example.com/article")

# Returns:
# {
#     "url": "https://example.com/article",
#     "title": "Article Title",
#     "content": "Clean extracted content...",
#     "description": "..."
# }

search(query)

Search the web and get content.
results = jina.search("Python best practices")

Configuration Options

jina = JinaTool(
    api_key="your_key",    # Optional: defaults to JINA_API_KEY
    timeout=30             # Request timeout in seconds
)

Function-Based Usage

from praisonai_tools import jina_read

# Quick read without instantiating class
content = jina_read("https://example.com")

CLI Usage

# Use with praisonai (works without API key)
praisonai --tools JinaTool "Read the content from https://example.com"

Error Handling

from praisonai_tools import JinaTool

jina = JinaTool()
result = jina.read("https://example.com")

if "error" in result:
    print(f"Error: {result['error']}")
else:
    print(f"Title: {result['title']}")
    print(f"Content: {result['content'][:500]}")

Common Errors

ErrorCauseSolution
Connection errorNetwork issueCheck internet connection
TimeoutPage took too longIncrease timeout or try later
Rate limitedToo many requestsAdd API key or add delays

Features

  • JavaScript rendering - Handles dynamic content
  • Ad removal - Extracts only main content
  • Clean output - LLM-ready text format
  • No API key required - Works with limits