Перейти к содержанию
НОВОЕПознакомьтесь с Alaaddin — вашим ИИ-джинном с голосом. trig8n запускается 1 января 2027. Что нового

Библиотека / Веб-скрейпинг и исследования

Веб-скрейпинг и исследования

Загрузка и кэширование веб-страниц с Bright Data и таблицей данных

Повторно используемый подворкфлоу, который другие воркфлоу вызывают с URL; сначала проверяет кэш в таблице данных с временными метками, иначе загружает страницу через Bright Data и возвращает markdown, HTML или JSON.

Что делает

## One scraper your other workflows call, with a cache in front of it By the fifth workflow that fetches a page you have written the same Bright Data call, the same error check and the same fallback five times. This is that code, once, as a sub-workflow other workflows call with a URL. ### How it works It starts on an Execute Workflow Trigger - no schedule, no webhook. A caller passes url, optionally a format (markdown, html or json) and a max_age_minutes. First it looks in the cache. A Data Table keeps every result with a timestamp, so asking for the same URL inside your freshness window returns instantly and spends nothing. Five workflows checking the same page each morning become one request. On a miss it fetches through Bright Data, then checks the payload properly: Bright Data returns validation errors and blocks with HTTP 200 and an error body, and an empty body means the domain never resolved. If the result is empty or suspiciously thin it retries once with render: true, running the page in a real browser - which is what rescues single-page apps. It always returns the same fields, including ok, from_cache and error, so the caller can branch on the result instead of guessing. ### Setup 1. A Bright Data Header Auth credential and a Web Unlocker zone. 2. A Data Table called scrape_cache with columns url, content, status and fetched_at. It will not add missing ones. 3. In another workflow, add Execute Sub-workflow, pick this one, pass a url.

Шаги

  1. A Workflow Asks For A Page
  2. Settings
  3. Read The Request
  4. Look In The Cache
  5. Is It Still Fresh?
  6. Serve From Cache?
  7. Straight From The Cache
  8. Fetch The Page
  9. Read What Came Back
  10. Does It Need A Browser?
  11. Try Again In A Browser
  12. Read The Rendered Page
  13. The First Fetch Was Fine
  14. Build The Answer

Всего шагов: 15.

Похожие автоматизации