Fetching Strategies
Understanding the different strategies used by Waterfall-Fetch
Fetching Strategies
Waterfall-Fetch employs multiple strategies to retrieve HTML content, ensuring optimal performance and reliability. This page explains the different strategies and how they work together.
Available Strategies
- Axios: A fast and lightweight HTTP client
- Node-fetch: A simple and modern fetch API for Node.js
- Stealth Puppeteer: A headless browser for JavaScript-heavy sites
Strategy Sets
Waterfall-Fetch uses two predefined strategy sets:
1. Cheap Set
Optimized for cost-effectiveness and speed:
- Axios
- Node-fetch
- Puppeteer (as a last resort)
2. JS Set
Designed for JavaScript-heavy websites:
- Puppeteer (with stealth mode)
- Axios (as a fallback)
- Node-fetch (as a final attempt)
Waterfall Approach
The waterfall method starts with the fastest and most cost-effective strategy to fetch the HTML of your target URL. If the initial attempt fails, Waterfall-Fetch seamlessly transitions to more robust methods, ensuring you ultimately receive the HTML from the target URL.
Customizing Strategies
You can customize the strategy set used by Waterfall-Fetch. Check out the Advanced Usage section to learn how to create and use custom strategy sets.
Next Steps
- Learn how to use different strategy sets in the Quick Start guide
- Explore the API Reference for detailed information on the
getHtml
function - Discover how to create Custom Strategies for advanced use cases