1
0
Files
Bridges/CLAUDE.md
2025-12-14 15:44:23 +01:00

3.6 KiB

Bridge Documentation

This directory contains custom RSS-Bridge implementations. For detailed documentation on creating and working with bridges, refer to the comprehensive guides in the Bridge_Docs/ folder.

Creating a New Bridge File

File: Bridge_Docs/01_How_to_create_a_new_bridge.md

Basic guide for creating a new bridge file with proper structure. Covers the mandatory declare(strict_types=1); declaration and provides a minimal working example using getSimpleHTMLDOM() to scrape content.

BridgeAbstract - Standard Bridge Base Class

File: Bridge_Docs/02_BridgeAbstract.md

Complete reference for BridgeAbstract, the base class for standard bridges. This is your primary resource for understanding:

  • Required constants (NAME, URI, DESCRIPTION, MAINTAINER)
  • How to define PARAMETERS for user input (text, number, list, checkbox)
  • The collectData() method and item structure (title, uri, content, timestamp, author, etc.)
  • Context handling with $this->queriedContext
  • Helper methods like saveCacheValue() and loadCacheValue()
  • Optional methods to override (getName, getURI, getIcon, detectParameters)

Use this when: Creating any standard bridge that scrapes HTML content directly.

FeedExpander - RSS/Atom Feed Extension

File: Bridge_Docs/03_FeedExpander.md

Specialized class for bridges that consume existing RSS/Atom feeds and enhance or modify them. Extends BridgeAbstract with feed parsing capabilities.

Key features:

  • Automatically parses RSS 1.0, RSS 2.0, and Atom 1.0 feeds
  • Override parseItem() to modify individual feed items
  • Call $this->collectExpandableDatas('feed_url') in collectData()
  • Can limit number of items fetched

Use this when: Working with sites that already provide feeds but need enhancement (e.g., content modification, filtering, or expanding truncated content).

WebDriverAbstract - JavaScript/XHR-Heavy Sites (NOT AVAILABLE)

File: Bridge_Docs/04_WebDriverAbstract.md

IMPORTANT: DO NOT USE WebDriverAbstract!

This server does not have Selenium WebDriver available. WebDriverAbstract cannot be used for bridge creation.

If a website requires WebDriverAbstract (i.e., content is loaded entirely via JavaScript and cannot be accessed through other methods), state that a bridge cannot be created for this website due to the lack of Selenium support on the server.

Alternative approaches to try before giving up:

  • Check if the website has a hidden API or JSON endpoint that can be accessed directly
  • Look for RSS/Atom feeds that might exist
  • Examine network requests in browser dev tools to find data sources
  • Try XPathAbstract or BridgeAbstract with different parsing strategies

XPathAbstract - XPath-Based Bridges

File: Bridge_Docs/05_XPathAbstract.md

Simplified bridge creation using XPath expressions. Ideal if you're familiar with XPath syntax.

Define these constants with XPath expressions:

  • FEED_SOURCE_URL - The source webpage
  • XPATH_EXPRESSION_ITEM - Selects each article/item container
  • XPATH_EXPRESSION_ITEM_TITLE - Extracts title from item context
  • XPATH_EXPRESSION_ITEM_CONTENT - Extracts content from item context
  • XPATH_EXPRESSION_ITEM_URI - Extracts link URL
  • Additional expressions for author, timestamp, enclosures, categories

Optional methods to override for formatting: formatItemTitle(), formatItemContent(), formatItemUri(), etc.

Use this when: You can identify the content you need using XPath expressions, making bridge creation declarative and concise.