Prompt Share
Format: SKILLMedia: Text
Web検索機能 - キーワードから検索結果を取得
Category: Uncategorized Author: こうた Published: 2026/05/11 19:10
SKILL definition (Markdown)
目的
指定したキーワードでウェブ検索を行い、上位 N 件の結果を取得します。
前提条件
- インターネット接続があること
- 使用する検索APIのキーとエンドポイントが設定されていること
使い方
keywordに検索したいキーワードを入力します。- 任意で
max_resultsに取得件数を指定します(デフォルト: 5)。
手順
- 検索APIへリクエストを送信する。
- 取得したJSONレスポンスからタイトル・URL・スニペットを抽出する。
- 結果をリスト形式で返す。
期待出力
[
{
"title": "ページタイトル",
"url": "https://example.com",
"snippet": "ページの抜粋..."
},
...
]
Additional resources1 file
scripts/main.pyScript · python
import os
import requests
def web_search(keyword, max_results=5):
api_key = os.getenv("SEARCH_API_KEY")
endpoint = "https://api.example.com/search"
params = {
"q": keyword,
"count": max_results
}
headers = {
"Ocp-Apim-Subscription-Key": api_key
}
response = requests.get(endpoint, params=params, headers=headers)
response.raise_for_status()
data = response.json()
results = []
for item in data.get("value", []):
results.append({
"title": item.get("name"),
"url": item.get("url"),
"snippet": item.get("snippet")
})
return results
# 例: print(web_search("OpenAI"))Discover more
Recommended prompts
Work & businessPromptText
Write a Product Requirements Document (PRD) from a Rough Idea
You are a senior product manager. Turn the rough product idea below into a concise, implementation ready Produc…
View detailsWritingPromptText
レポート構成を一瞬で作るプロンプト
レポート課題から論点・主張・段落構成・調査項目まで一気に作るプロンプト。
View detailsUncategorizedPromptText
データ分類プロンプト
以下のテキストをカテゴリに分類してください。各行ごとに1つのカテゴリを付け、結果はJSON形式で返してください。
View details