Claude Code में web scraping
Claude Code में Spicrawl MCP server जोड़ें। फिर Claude web pages को साफ़ Markdown में पढ़ सकता है।
Set up करें
तीन steps Claude Code को tools, Spicrawl code लिखने की जानकारी, और दोनों के इस्तेमाल के नियम देते हैं। या तीनों spicrawl init --client claude से एक साथ कर लें।
अपनी API key सेट करें:
bashexport SPICRAWL_API_KEY=spicrawl_live_... # add to your shell profileMCP server जोड़ें। आपका shell key भर देता है, और Claude Code उसे repository के बाहर
~/.claude.jsonमें store करता है। हर project में इस्तेमाल करने के लिए--scope userजोड़ें।bashclaude mcp add --transport http spicrawl https://mcp.spicrawl.com/mcp \ --header "Authorization: Bearer $SPICRAWL_API_KEY"Team के लिए, इसकी जगह project root में
.mcp.jsoncommit करें। Claude Code हर व्यक्ति की अपनी key उसके environment से पढ़ता है:.mcp.json{ "mcpServers": { "spicrawl": { "type": "http", "url": "https://mcp.spicrawl.com/mcp", "headers": { "Authorization": "Bearer ${SPICRAWL_API_KEY}" } } } }Skill install करें। जब किसी task में web data शामिल हो, या जब आप
/spicrawltype करें, तब Claude उसे load करता है:bashmkdir -p .claude/skills/spicrawl curl -fsSL https://app.spicrawl.com/skill.md -o .claude/skills/spicrawl/SKILL.mdइस section को project root में
CLAUDE.mdमें paste करें:CLAUDE.md## Web data (Spicrawl) Use Spicrawl to read web pages: the spicrawl_* MCP tools in chat, or POST https://api.spicrawl.com/v1/scrape with `Authorization: Bearer $SPICRAWL_API_KEY` in code. Docs: https://docs.spicrawl.com/llms.txt (append .md to any page URL for Markdown). - Ask for markdown: `response_format: "markdown"` (API default is html); on spicrawl_scrape, `format: "markdown"`. - Check the site's status, not only the HTTP status: `X-Target-Status` header, or `status` in the JSON envelope (spicrawl_scrape with `format: "json"`). 200 is the page; 404/410 mean it does not exist; 403/429/503 mean the site refused, so escalate. - On an error, switch on `code`. Retry only when `retryable` is true, after `retry_after_seconds`. Read `diagnostics.hint` and change what it names first. Never retry ERR::REQUEST::*, ERR::AUTH::* or ERR::LIMIT::QUOTA_EXCEEDED. - Escalate one step at a time and stop at the first that works: plain fetch (1 credit) -> `js_render: true` (3) -> add the user's own `proxy` if they have one. Empty or skeleton content means render; ERR::UPSTREAM::CHALLENGE or a 403 target status means retry once, then the user's own proxy. - Set `max_cost` on every request to the price of the step you intend. - Keep the cache on (default). Set `cache: false` only for prices, stock or other live data. - Trim tokens with `main_content_only` (on by default for markdown), `include_tags`, `exclude_tags`. - For more than 20 URLs, use a batch job (spicrawl_batch_submit / POST /v1/batch). Batch items return html, markdown or text (spicrawl_batch_submit defaults to markdown, POST /v1/batch to html). Extraction, screenshots, actions and sessions are refused with a 400 before anything is charged: scrape those URLs one by one. - Never print or commit SPICRAWL_API_KEY. Log `X-Request-Id` for failures.इसे
claude mcp listसे जाँचें, या session में/mcpसे। आपको 25spicrawl_*tools दिखने चाहिए।
Plugin पसंद है? यह MCP server और skill को bundle करता है, इसलिए आप steps 2 और 3 छोड़ सकते हैं। Enable करने पर Claude Code आपकी key माँगता है:
claude plugin marketplace add OfficialSpicrawl/agent-plugins
claude plugin install spicrawl@spicrawl-pluginsआज़माने के लिए पहला task
Project में claude शुरू करें और पूछें:
Use Spicrawl to read https://example.com/pricing as markdown. List each plan with its monthly price.
If the page comes back empty, retry with rendering. Tell me how many credits it cost.Claude spicrawl_scrape call करता है। Cost बताने के लिए उसे format: "json" चाहिए, क्योंकि उस envelope में credits होता है। पूरा walkthrough Claude Code से website कैसे scrape करें में है।
यह क्या कर सकता है
Server agent को 25 spicrawl_* tools देता है। हर call आपकी API key के तहत चलती है, उन्हीं limits और credits के साथ जो सीधी API call में होते हैं।
- एक page पढ़ें:
spicrawl_scrapeMarkdown (default), text, HTML, JSON या PDF लौटाता है। - कई pages पढ़ें:
spicrawl_batch_submitएक बार में 10,000 URLs तक queue करता है। इसके बादspicrawl_batch_statusऔरspicrawl_batch_resultsचलाएँ। - Login के पीछे के pages:
spicrawl_session_createcalls के बीच cookies और storage बनाए रखता है। - Failure debug करें:
spicrawl_requests_listऔरspicrawl_request_get। - Usage जाँचें:
spicrawl_usage_summaryऔर बाकी usage tools। इनके लिएreadscope वाली key चाहिए। - चीज़ें खोजें:
spicrawl_docs_searchऔरspicrawl_docs_readSpicrawl docs खोजते और पढ़ते हैं।
एक tool, spicrawl_browser_connect_url, listed है लेकिन जल्द आ रहा है। spicrawl_scrape पर rendering argument render है, न कि API का js_render।
जानने लायक बातें
- Crawling नहीं। Spicrawl links follow नहीं करता और pages नहीं ढूँढता। Agent को URLs दें।
- प्रति request credits। Plain fetch 1 credit का है। JavaScript rendering 3 का। Full-browser rendering 8 का।
- Failures free हैं। Fail हुई request की कीमत 0 credits है।
- Cache समय बचाता है, credits नहीं। Cache हिट की कीमत उसी fetch जितनी है जिसने उसे store किया था।
- हर call की सीमा तय करें।
max_costset करें, और जो request ज़्यादा खर्च कर सकती है उसे चलने से पहले ही refuse कर दिया जाता है। - जल्द आ रहा है: managed proxies, stealth mode, एक remote browser और एक plain-language prompt से AI extraction। आज आप अपना proxy ला सकते हैं।
अक्सर पूछे जाने वाले सवाल
मैं Claude Code में Spicrawl कैसे जोड़ूँ?
SPICRAWL_API_KEY को export करें, फिर claude mcp add --transport http spicrawl https://mcp.spicrawl.com/mcp --header "Authorization: Bearer $SPICRAWL_API_KEY". चलाएँ। इसे claude mcp list से जाँचें।
मैं setup अपनी team के साथ कैसे share करूँ?
Commit .mcp.json at the project root with the header "Bearer ${SPICRAWL_API_KEY}". Claude Code fills in each person’s own key from their environment when it starts.
क्या Claude Code plugin है?
हाँ। claude plugin marketplace add OfficialSpicrawl/agent-plugins चलाएँ, फिर claude plugin install spicrawl@spicrawl-plugins। यह MCP server और skill को bundle करता है, और enable करने पर आपकी key माँगता है।
Claude को js_render के लिए "unknown argument" error क्यों मिलता है?
spicrawl_scrape tool में argument का नाम render है। HTTP API में नाम js_render है।
हर page की कीमत कितनी है?
Plain fetch की कीमत 1 credit है, JavaScript rendering की 3 और full-browser rendering की 8। Failed requests की कीमत 0। Cache hit की कीमत उतनी ही है जितनी उस fetch की जिसने इसे store किया। Agent से हर request पर max_cost सेट करने को कहें ताकि वह आपकी उम्मीद से ज़्यादा खर्च न करे।