Skip to content

Official Crawl4AI Cloud: a hosted web scraping, extraction, and search API for AI agents. Free API key, 1,000 credits a month, no card. Fully open source: this repo is the Apache-2.0 crawler that powers it, and you can self-host it.

996 B
Raw Blame
"""
NSTProxy Integration Examples for crawl4ai
------------------------------------------

NSTProxy is a premium residential proxy provider.
👉 Purchase Proxies: https://nstproxy.com
💰 Use coupon code "crawl4ai" for 10% off your plan.

"""
import asyncio
from crawl4ai import AsyncWebCrawler, BrowserConfig


async def main():
    # Using HTTP proxy
    browser_config = BrowserConfig(proxy_config={"server": "http://gate.nstproxy.io:24125"})
    async with AsyncWebCrawler(config=browser_config) as crawler:
        result = await crawler.arun(url="https://example.com")
        print("[HTTP Proxy] Status:", result.status_code)

    # Using SOCKS proxy
    browser_config = BrowserConfig(proxy_config={"server": "socks5://gate.nstproxy.io:24125"})
    async with AsyncWebCrawler(config=browser_config) as crawler:
        result = await crawler.arun(url="https://example.com")
        print("[SOCKS5 Proxy] Status:", result.status_code)


if __name__ == "__main__":
    asyncio.run(main())