Shifterと一緒に使用する Zapier
Zapier にはネイティブのプロキシフィールドはありませんが、Code by Zapier アクションと Webhooks by Zapier アクションはどちらも、数行の JavaScript または Python で Shifter の Web Scraping API を経由したアウトバウンドリクエストを実行できます。
クイックスタート
インストール
// Add a 'Code by Zapier' or 'Webhooks by Zapier' action — no install required. 基本的な使い方
// In a "Code by Zapier" (Run JavaScript) action:
const apiKey = inputData.shifter_api_key;
const targetUrl = inputData.target_url;
const country = inputData.country || "us";
const params = new URLSearchParams({
api_key: apiKey,
url: targetUrl,
country: country,
render_js: "1",
session_id: inputData.zap_run_id, // sticky residential IP for this run
});
const response = await fetch(`https://scrape.shifter.io/v1?${params}`);
const html = await response.text();
output = { html, status: response.status, length: html.length }; 機能
例
Code by Zapier -- スティッキーセッションを使用した JavaScript
Shifter Web Scraping APIを通じてページを取得するカスタムJSステップを実行します。Zapの実行IDから派生したsession_idを渡すことで、実行中のすべてのステップが1つのレジデンシャルIPを共有します。
// "Code by Zapier" action -> Run JavaScript
//
// inputData.target_url -> https://example.co.uk/products
// inputData.country -> "uk"
// inputData.shifter_api_key -> your Shifter API key (Storage by Zapier secret)
// inputData.zap_run_id -> Zap run id from the trigger
const params = new URLSearchParams({
api_key: inputData.shifter_api_key,
url: inputData.target_url,
country: inputData.country || "us",
render_js: "1", // headless browser
session_id: inputData.zap_run_id, // sticky IP per Zap run
});
const response = await fetch(`https://scrape.shifter.io/v1?${params}`);
const html = await response.text();
// Extract a value with a regex — Zapier's Code action doesn't bundle cheerio.
const titleMatch = html.match(/<title>([\s\S]*?)<\/title>/i);
const priceMatch = html.match(/class=["']price["'][^>]*>([^<]+)/i);
output = {
status: response.status,
title: titleMatch?.[1]?.trim(),
price: priceMatch?.[1]?.trim(),
length: html.length,
}; Code by Zapier -- Python (urllib)
Zapier の Python ランタイムで Web Scraping API を呼び出してレスポンスを解析するのに十分です。Python を使いたい場合や標準ライブラリへのアクセスが必要な場合に便利です。
# "Code by Zapier" action -> Run Python
import urllib.request
import urllib.parse
import re
params = urllib.parse.urlencode({
"api_key": input_data["shifter_api_key"],
"url": input_data["target_url"],
"country": input_data.get("country", "us"),
"render_js": "1",
"session_id": input_data["zap_run_id"],
})
req = urllib.request.Request(
f"https://scrape.shifter.io/v1?{params}",
headers={"User-Agent": "ZapierShifterClient/1.0"},
)
with urllib.request.urlopen(req, timeout=30) as resp:
html = resp.read().decode("utf-8", errors="replace")
status = resp.status
# Extract whatever the Zap needs.
title = (re.search(r"<title>(.*?)</title>", html, re.IGNORECASE | re.DOTALL) or [None, ""])[1].strip()
prices = re.findall(r'class="price"[^>]*>([^<]+)', html)
return {
"status": status,
"title": title,
"prices": prices[:10],
} ZapierのWebhook -- カスタムリクエスト
Zap でコード ステップが使えない場合(一部のプラン)は、Zapier の Webhooks「Custom Request」アクションを使用して、クエリ パラメータ付きで Web スクレイピング API を直接呼び出してください。
# Action: Webhooks by Zapier -> Custom Request
#
# Method: GET
# URL: https://scrape.shifter.io/v1
# Query String Params:
# api_key = {{credentials.shifter_api_key}}
# url = {{trigger.target_url}}
# country = us
# render_js = 1
# session_id = {{trigger.zap_run_id}}
#
# Headers:
# User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
#
# Output:
# The response body is the fully-rendered HTML, returned to Zapier
# as a single output field. Pipe it into a Filter, Formatter, or
# another Code step to parse what you need.
#
# Notes:
# - session_id uses the Zap run id so all requests within one run
# share the same residential IP (sticky session, 10 min default).
# - country can be sourced from a previous step
# ({{step1.country}}) for per-item geo routing. Zapierによるストレージ - シークレット管理
API keyをCodeアクションに直接貼り付けないでください。ShifterのAPI keyを暗号化した状態でZap全体で再利用するには、Storage by Zapier(またはエンタープライズプランのZapier Vault)を使用してください。
// One-off setup (run once via Code by Zapier):
//
// await fetch("https://store.zapier.com/api/records", {
// method: "POST",
// headers: { "X-Secret": ZAPIER_STORAGE_SECRET },
// body: JSON.stringify({
// shifter_api_key: "YOUR_SHIFTER_API_KEY",
// }),
// });
//
// Then in any future Zap that needs the Shifter API key:
const storageRes = await fetch(
"https://store.zapier.com/api/records?key=shifter_api_key",
{ headers: { "X-Secret": process.env.ZAPIER_STORAGE_SECRET } },
);
const { shifter_api_key } = await storageRes.json();
const params = new URLSearchParams({
api_key: shifter_api_key,
url: inputData.target_url,
country: "us",
render_js: "1",
session_id: inputData.run_id,
});
const response = await fetch(`https://scrape.shifter.io/v1?${params}`);
// ... use response as in the previous examples よくある質問
Shifter と Zapier の併用に関するよくある質問。
Not on the standard Webhooks action — Zapier's HTTP layer doesn't expose a proxy field. The supported workarounds are Code by Zapier (run a JavaScript or Python step that calls the Shifter Web Scraping API) or the Webhooks Custom Request action pointed at https://scrape.shifter.io/v1 with the country, render_js, and session_id query params.
Pick Code by Zapier > Run JavaScript (or Python). Inside the step, call https://scrape.shifter.io/v1 with the target URL, your api_key, country, render_js, and session_id as query params. The response body is the fully-rendered HTML. The full setup is about 15 lines of code.
run内のすべてのShifter呼び出しで安定したsession_idを渡してください -- Zapのラン ID、トリガーレコードID、またはトリガーペイロードのハッシュを使用します。同じsession_idを持つリクエストは同じレジデンシャルIPを経由してルーティングされます。セッションはデフォルトで10分間スティッキーに維持されます。
はい。country クエリパラメータ(例: country=uk、country=jp)を渡してください。前のステップ(`{{step1.country}}`)から取得し、Zapier が各アイテムを適切な住宅プールにルーティングします。ローカライズされた価格監視やマルチリージョンのSERP チェックに便利です。
Storage by Zapier(無料)またはZapier Vault(エンタープライズ)を使用してください。どちらもサーバー側でシークレットを暗号化します。API keyをCodeアクションに直接貼り付けることは避けてください。Zapの履歴やチームの監査ログに表示されます。
軽いスクレイピング(1回の実行あたり数百ページ未満、単一ステップのパース)には、Zapier + Shifter がうまく機能します。より重い作業——ページネーション、ディープパース、数千アイテム——には、Zapier のタスク制限に達します。その場合は、Zapier から n8n またはカスタムバックエンドをトリガーし、そこで Shifter を実行してください。
でShifterを使い始める Zapier
Shifterの2億500万件以上のレジデンシャル・ISPプロキシを、Code by ZapierまたはWebhooks Custom RequestからZapに追加できます。実行ごとのスティッキーセッション・アイテムごとのジオ指定・ビルトインのヘッドレスレンダリング・Storage / Vaultの完全な認証情報サポートに対応しています。