Spicrawl अब OpenAI Agents SDK, LangChain, Codex, Claude Code और अन्य के साथ काम करता है।Integrations देखें
Content पर जाएँ

Copilot के साथ VS Code में web scraping

VS Code में Spicrawl MCP server जोड़ें। फिर agent mode में Copilot web pages को साफ़ Markdown में पढ़ सकता है।

Set up करें

तीन steps Copilot को tools, Spicrawl code लिखने की जानकारी, और दोनों के इस्तेमाल के नियम देते हैं। spicrawl init --client vscode पहले दो आपके लिए कर देता है।

  1. Project में .vscode/mcp.json बनाएँ। VS Code mcpServers नहीं, servers key इस्तेमाल करता है। Password input से VS Code आपकी key एक बार माँगकर store कर लेता है, इसलिए file को commit करना सुरक्षित है:

    .vscode/mcp.json
    {
      "inputs": [
        {
          "type": "promptString",
          "id": "spicrawl-api-key",
          "description": "Spicrawl API key",
          "password": true
        }
      ],
      "servers": {
        "spicrawl": {
          "type": "http",
          "url": "https://mcp.spicrawl.com/mcp",
          "headers": { "Authorization": "Bearer ${input:spicrawl-api-key}" }
        }
      }
    }
  2. Command Palette से MCP: List Servers चलाएँ और spicrawl शुरू करें। पूछे जाने पर अपनी key डालें।

  3. Skill install करें, और उसे commit करें:

    bash
    spicrawl skill install --client vscode
    
    # Without the CLI:
    mkdir -p .github/skills/spicrawl
    curl -fsSL https://app.spicrawl.com/skill.md -o .github/skills/spicrawl/SKILL.md
  4. इसे .github/copilot-instructions.md के रूप में save करें, या अपनी मौजूदा file में जोड़ें:

    .github/copilot-instructions.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.
  5. Chat view खोलें, Agent mode पर जाएँ और tools picker खोलें। spicrawl 25 spicrawl_* tools list करता है।

Copilot CLI और Copilot cloud agent हर एक अपना MCP config पढ़ता है। docs page दोनों को कवर करता है।

आज़माने के लिए पहला task

Agent mode में Copilot Chat खोलें और पूछें:

prompt
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.

Agent को format: "markdown" के साथ spicrawl_scrape call करना चाहिए। उसे render: true तभी जोड़ना चाहिए जब पहला result खाली हो।

यह क्या कर सकता है

Server agent को 25 spicrawl_* tools देता है। हर call आपकी API key के तहत चलती है, उन्हीं limits और credits के साथ जो सीधी API call में होते हैं।

  • एक page पढ़ें: spicrawl_scrape Markdown (default), text, HTML, JSON या PDF लौटाता है।
  • कई pages पढ़ें: spicrawl_batch_submit एक बार में 10,000 URLs तक queue करता है। इसके बाद spicrawl_batch_status और spicrawl_batch_results चलाएँ।
  • Login के पीछे के pages: spicrawl_session_create calls के बीच cookies और storage बनाए रखता है।
  • Failure debug करें: spicrawl_requests_list और spicrawl_request_get।
  • Usage जाँचें: spicrawl_usage_summary और बाकी usage tools। इनके लिए read scope वाली key चाहिए।
  • चीज़ें खोजें: spicrawl_docs_search और spicrawl_docs_read Spicrawl 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_cost set करें, और जो request ज़्यादा खर्च कर सकती है उसे चलने से पहले ही refuse कर दिया जाता है।
  • जल्द आ रहा है: managed proxies, stealth mode, एक remote browser और एक plain-language prompt से AI extraction। आज आप अपना proxy ला सकते हैं।

अक्सर पूछे जाने वाले सवाल

VS Code "mcpServers" की जगह "servers" क्यों इस्तेमाल करता है?

यह VS Code का अपना format है। .vscode/mcp.json में servers key इस्तेमाल करें, जैसा इस page के example में है।

मेरी key कहाँ store होती है?

The inputs entry with password: true makes VS Code ask for the key once and store it. The file only holds ${input:spicrawl-api-key}, so you can commit it.

क्या यह Copilot CLI और cloud agent के साथ काम करता है?

हाँ, लेकिन हर एक अपना MCP config पढ़ता है। Copilot CLI copilot mcp add इस्तेमाल करता है। Cloud agent को repository admin Settings → Copilot → MCP servers में set up करता है। Docs page दोनों को कवर करता है।

spicrawl init --client vscode क्या लिखता है?

यह .vscode/mcp.json और .github/skills/spicrawl/SKILL.md पर skill लिखता है। यह instructions file या Copilot CLI या cloud agent config नहीं लिखता।

हर page की कीमत कितनी है?

Plain fetch की कीमत 1 credit है, JavaScript rendering की 3 और full-browser rendering की 8। Failed requests की कीमत 0। Cache hit की कीमत उतनी ही है जितनी उस fetch की जिसने इसे store किया। Agent से हर request पर max_cost सेट करने को कहें ताकि वह आपकी उम्मीद से ज़्यादा खर्च न करे।