| name | web-scraper |
| description | Configurable web scraping service. Extract structured data from any public website with built-in security controls. |
| auto_trigger | false |
| version | 1.0.0 |
| author | REY |
| tags | ["scraping","data-extraction","automation","web"] |
Web Scraper Service
汎用ウェブスクレイピングサービス。任意の公開サイトから構造化データを抽出。
対応カテゴリ
Eコマース
- 商品情報(名前、価格、画像、説明)
- 在庫状況・レビュー・評価・価格履歴
不動産
求人
SNS/メディア
- 投稿・コメント・エンゲージメント統計・ハッシュタグ分析
使用方法
基本
「[URL]から商品情報をスクレイピングして」
「[サイト]の全記事タイトルを抽出」
詳細指定
URL: [target_url]
抽出項目: [name, price, image, description]
ページ数: [max_pages]
出力形式: [CSV/JSON/Excel]
技術スタック
前提条件
npm install puppeteer cheerio
セキュリティモジュール(必須)
すべてのリクエスト前に以下のバリデーションを実行:
const { URL } = require('url');
const dns = require('dns').promises;
const net = require('net');
function validateUrl(input) {
let parsed;
try {
parsed = new URL(input);
} catch {
throw new Error(`Invalid URL: ${input}`);
}
if (!['http:', 'https:'].includes(parsed.protocol)) {
throw new Error(`Blocked protocol: ${parsed.protocol}`);
}
return parsed;
}
const PRIVATE_RANGES = [
/^127\./,
/^10\./,
/^172\.(1[6-9]|2\d|3[01])\./,
/^192\.168\./,
/^169\.254\./,
/^0\./,
/^::1$/,
/^fc00:/i,
/^fe80:/i,
];
function isPrivateIp(ip) {
return .( r.(ip));
}
() {
parsed = (urlString);
{ address } = dns.(parsed.);
((address)) {
();
}
response = (urlString, {
: { : },
: ,
: .(),
});
response;
}
ブラウザベース(JavaScript必要なサイト)
const { createClient } = require('../cloudflare-browser/scripts/puppeteer-client');
async function scrapeWithBrowser(url, selectors) {
validateUrl(url);
const client = await createClient({ headless: true });
await client.executeSequence([
{ type: 'navigate', url },
{ type: 'wait', ms: 3000 }
]);
const data = await client.page.evaluate((sel) => {
return [...document.querySelectorAll(sel.container)].map(el => ({
name: el.querySelector(sel.name)?.textContent?.trim(),
price: el.querySelector(sel.price)?.textContent?.trim(),
image: el.querySelector('img')?.src
}));
}, selectors);
await client.close();
data;
}
HTTPベース(静的サイト)
const cheerio = require('cheerio');
async function scrapeStatic(url, selectors) {
const response = await safeFetch(url);
const html = await response.text();
const $ = cheerio.load(html);
return $(selectors.container).map((i, el) => ({
name: $(el).find(selectors.name).text().trim(),
price: $(el).find(selectors.price).text().trim()
})).get();
}
レート制限
const RATE_LIMIT = {
minDelayMs: 2000,
maxDelayMs: 5000,
maxRequestsPerMinute: 20,
maxPages: 100,
};
async function rateLimit() {
const delay = RATE_LIMIT.minDelayMs +
Math.random() * (RATE_LIMIT.maxDelayMs - RATE_LIMIT.minDelayMs);
await new Promise(r => setTimeout(r, delay));
}
出力フォーマット
CSV
name,price,url,image
"Product 1","$99.99","https://...","https://..."
JSON
{
"scraped_at": "2026-02-08T12:00:00Z",
"source_url": "https://example.com",
"total_items": 150,
"data": [...]
}
Excel
セキュリティチェックリスト
禁止事項
- ログイン必要なプライベートデータ
- 著作権保護コンテンツの複製
- 違法な用途
- 個人情報の収集