Tool

Extract Content from WordPress

A LlamaIndex data loader that fetches text from WordPress blog posts and pages using the WordPress API, parsing HTML with BeautifulSoup for AI indexing.

Works with wordpressbeautifulsoup

76
Spark score
out of 100
Updated 2 days ago
Version 0.14.23
Models

Add to Favorites

Why it matters

Ingest and structure content from your WordPress site for use in AI applications. This asset connects to your WordPress API to extract blog posts and pages, preparing them for indexing and analysis.

Outcomes

What it gets done

01

Fetch blog posts and pages from a WordPress site via its API.

02

Parse HTML content to extract relevant text.

03

Optionally retrieve custom post types.

04

Prepare extracted content for LlamaIndex integration.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/li-reader-readers-wordpress | bash

Overview

Wordpress Loader

WordPress Loader is a LlamaIndex data reader that fetches text content from WordPress sites using the WordPress API. It parses HTML with BeautifulSoup to extract text from blog posts, static pages, and custom post types, then loads the content into LlamaIndex. Use this loader when building LlamaIndex applications that need to load data from WordPress sites. It works with WordPress installations where you can provide a base URL and optionally authentication credentials.

What it does

WordPress Loader extracts text content from WordPress sites via the WordPress API and loads it into LlamaIndex. It fetches both static pages and blog posts, parses HTML using BeautifulSoup to extract text, and supports additional custom post types.

When to use - and when NOT to

Use this loader when you need to index WordPress content for LlamaIndex applications. Use it when you have WordPress credentials and need programmatic access to multiple posts or pages at once.

Do NOT use this loader if you need real-time content updates (it's a batch loader, not a webhook listener) or if your WordPress site blocks API access. For single-page scraping or non-WordPress sites, consider alternative loaders.

Inputs and outputs

You provide the base URL of your WordPress installation (e.g., https://www.mysite.com), and optionally a username and application password for authenticated access. You can configure whether to retrieve pages, posts, or both, and specify additional custom post types as a comma-separated list.

The loader returns documents containing the extracted text content from each WordPress page or post.

Integrations

This loader integrates with LlamaIndex as a data reader, designed specifically to load content into LlamaIndex's document processing pipeline. It uses the WordPress API to fetch content and BeautifulSoup library to parse HTML and extract text from articles.

Installation:

pip install llama-index-readers-wordpress

Basic usage:

from llama_index.readers.wordpress import WordpressReader

loader = WordpressReader(
    url="https://www.mysite.com",
    username="my_username",
    [REDACTED],
)
documents = loader.load_data()

For custom post types:

from llama_index.readers.wordpress import WordpressReader

loader = WordpressReader(
    url="https://www.mysite.com",
    username="my_username",
    [REDACTED],
    additional_post_types="webiners,podcasts",
)
documents = loader.load_data()

Who it's for

This loader is designed for users building LlamaIndex applications who need to load data from WordPress sites. By default it retrieves both pages and posts, but you can disable either with get_pages=False or get_posts=False parameters.

Source README

Wordpress Loader

pip install llama-index-readers-wordpress

This loader fetches the text from Wordpress blog posts using the Wordpress API. It also uses the BeautifulSoup library to parse the HTML and extract the text from the articles.

Usage

To use this loader, you need to pass base url of the Wordpress installation
(e.g. https://www.mysite.com) and optionally a username, and an application
password for the user (more about application passwords
here)

from llama_index.readers.wordpress import WordpressReader

loader = WordpressReader(
    url="https://www.mysite.com",
    username="my_username",
    [REDACTED],
)
documents = loader.load_data()

This loader is designed to be used as a way to load data into
LlamaIndex.

Pages and Posts

Be default, the loader retrieves both Wordpress pages (static content) and
posts (blog entries) from the target site. This behavior can be configured
by setting get_pages=False or get_posts=False when initializing the
WordpressReader object.

Additional Custom Post types

To scrape additional custom endpoints beside posts and pages, you can specify additional_post_types as a comma-separated list (e.g., additional_post_types="custom-pages,custom-posts") when initializing the WordpressReader object.

from llama_index.readers.wordpress import WordpressReader

loader = WordpressReader(
    url="https://www.mysite.com",
    username="my_username",
    [REDACTED],
    additional_post_types="webiners,podcasts",
)
documents = loader.load_data()

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.