OpenAICloudflare Developer PlatformApr 8, 2026, 12:00 AM

AI Search - Website Source CSS content selectors for precise content extraction in AI Search

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

AI Search — Website Source CSS content selectors

Key Points

  • CSS selectors paired with URL globs
  • First-match wins; evaluated in order
  • Limit of 10 selector entries per instance

Summary

AI Search now supports CSS content selectors for website data sources. You can pair URL glob patterns with CSS selectors so the crawler extracts only the relevant page fragments (ignoring navigation, sidebars, footers, etc.). Matched elements are converted to Markdown and indexed. Configure selectors via the dashboard or the API.

Key Points

  • Specify content selectors as { "path": "<glob>", "selector": "<css>" } (e.g. {"path":"**/blog/**","selector":"article .post-body"}).
  • Selectors are evaluated in order; the first matching pattern wins.
  • You can define up to 10 content selector entries per instance.
  • Extracted elements are converted to Markdown before indexing to improve relevance.
  • Configure via dashboard or API (POST https://api.cloudflare.com/client/v4/accounts/{account_id}/ai-search/instances).

Practical notes

  • Use specific globs to avoid unintended matches.
  • Validate selectors against representative pages before deploying.
  • Monitor indexing results to confirm only desired content is captured.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

AI Search - ウェブサイトソース CSS コンテンツセレクターによる精密なコンテンツ抽出

概要

AI Search はウェブサイトデータソースに対して CSS コンテンツセレクターをサポートするようになりました。クローリングしたページのどの部分を抽出してインデックス化するかを、URL の glob パターンに対応する CSS セレクターで指定できます。コンテンツセレクターを使うと、ナビゲーション、サイドバー、フッターなどのボイラープレートを無視して、関連するコンテンツだけをインデックス化できます。

ページの URL が glob パターンに一致した場合、そのパターンに対応する CSS セレクターに一致する要素のみが抽出され、インデックス用に Markdown に変換されます。

主なポイント

  • CSS コンテンツセレクターで、ページ内の抽出範囲を細かく指定可能
  • URL の glob パターンと CSS セレクターを組み合わせて指定
  • 抽出された要素は Markdown に変換されてインデックス化される
  • セレクターは順番に評価され、最初に一致したものが適用される
  • インスタンスあたり最大 10 件のコンテンツセレクターを定義可能

設定方法

ダッシュボードまたは API から設定できます。API の例:

curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/ai-search/instances" \ 
 -H "Authorization: Bearer {api_token}" \ 
 -H "Content-Type: application/json" \ 
 -d '{ "id": "my-ai-search", "source": "https://example.com", "type": "web-crawler", "source_params": { "web_crawler": { "parse_options": { "content_selector": [ { "path": "**/blog/**", "selector": "article .post-body" } ] } } } }'

注意事項

  • セレクターは定義順に評価され、最初に一致したパターンが適用されます。
  • インスタンスあたり最大 10 エントリまで指定できます。
  • 抽出された要素は Markdown に変換されてインデックス化されます。
  • 詳細および例は content selectors documentation を参照してください。