scrapfly-sdk-rust
/scrapfly-sdk-rust
Pobiera strony z programu w Rust przez SDK Scrapfly: renderowanie JavaScript, zrzuty ekranu i dane strukturalne. Przydaje się przy asynchronicznych programach w Rust.
- Autor
- scrapfly ↗
- Repozytorium
- skills ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 11.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 6
Brak sygnałów. Repozytorium zmienione 11.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Pobiera strony z programu w Rust przez SDK Scrapfly: renderowanie JavaScript, zrzuty ekranu i dane strukturalne. Przydaje się przy asynchronicznych programach w Rust.
Oryginalny opis (EN)
Web scraping from Rust with the Scrapfly SDK (`scrapfly-sdk` crate). Use when the user asks to scrape a URL, bypass anti-bot protection, render JavaScript, capture screenshots, or extract structured data from an async Rust program.
Jak działa
- When to use
- Setup
- Basic scrape
- Anti-bot bypass, geo-targeting, JS rendering
- Screenshots and extraction
- Concurrent scraping
- Important notes
Podgląd SKILL.md
---
name: scrapfly-sdk-rust
description: >-
Web scraping from Rust with the Scrapfly SDK (`scrapfly-sdk` crate). Use when
the user asks to scrape a URL, bypass anti-bot protection, render JavaScript,
capture screenshots, or extract structured data from an async Rust program.
---
# Scrapfly Rust SDK
Use the `scrapfly-sdk` crate to scrape web pages from Rust with proxy rotation,
anti-bot bypass (Unblocker), JavaScript rendering, screenshots, and AI extraction.
The client is async (Tokio) and uses typed builders for every config.
## When to use
- Scraping web pages (HTML, JSON, text, markdown) from a Rust codebase
- Bypassing anti-bot protections (Cloudflare, DataDome, PerimeterX, Kasada)
- Rendering JavaScript-heavy pages with a headless browser
- Capturing screenshots or extracting structured data
## Setup
```bash
cargo add scrapfly-sdk
export SCRAPFLY_API_KEY="your-api-key"
```
Get your API key at [scrapfly.io](https://scrapfly.io).
## Basic scrape
```rust
use scrapfly_sdk::{Client, ScrapeConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::builder()
.api_key(std::env::var("SCRAPFLY_API_KEY")?)
.build()?;
let config = ScrapeConfig::builder("https://web-scraping.dev/products").build()?;
let result = client.scrape(&config).await?;
println!(
"status={} content={}",
result.result.status_code,
result.result.content,
);
Ok(())
}
```
## Anti-bot bypass, geo-targeting, JS rendering
Chain typed builder methods. `proxy_pool` and `format` take enums.
```rust
use scrapfly_sdk::{Client, ScrapeConfig, Format, ProxyPool};
let config = ScrapeConfig::builder("https://web-scraping.dev/products")
.unblocker(true) // bypass anti-bot
.country("us") // proxy country (ISO 3166-1 alpha-2)
.proxy_pool(ProxyPool::PublicResidentialPool) // or PublicDatacenterPool
.render_js(true) // headless browser rendering
.wait_for_selector("div.product") // requires render_js
.rendering_wait(5000) // ms, requires render_js
.format(Format::Markdown) // clean, LLM-friendly content
.build()?;
let result = client.scrape(&config).await?;
```
## Screenshots and extraction
```rust
use scrapfly_sdk::{Client, ScreenshotConfig, ExtractionConfig};
let shot = client
.screenshot(&ScreenshotConfig::builder("https://web-scraping.dev/products").build()?)
.await?;
// shot.image is the raw bytes; shot.save("products", None)? writes it to disk
let html = result.result.content.into_bytes();
let extraction = ExtractionConfig::builder(html, "text/html")
.extraction_prompt("extract all product names and prices")
.build()?;
let data = client.extract(&extraction).await?;
println!("{}", serde_json::to_string_pretty(&data.data)?);
```
## Concurrent scraping
`concurrent_scrape` returns a `Stream` (powered by `buffer_unordered`):
```rust
use futures_util::StreamExt;
let configs = vec![
ScrapeConfig::builder("https://web-scraping.dev/products?page=1").build()?,
ScrapeConfig::builder("https://web-scraping.dev/products?page=2").build()?,
];
let mut stream = client.concurrent_scrape(configs, 5); // concurrency = 5
while let Some(result) = stream.next().await {
let result = result?;
println!("{}", result.result.content.len());
}
```
## Important notes
- `render_js(true)` is required for `rendering_wait`, `wait_for_selector`, and screenshots
- `ProxyPool::PublicResidentialPool` is recommended alongside `unblocker(true)`
- `unblocker(true)` is the current builder input for the anti-bot bypass;
`asp(true)` is the deprecated alias and keeps working forever. Only the name
changed; the SDK sends `asp` on the wire either way. Call one, not both; an
explicitly supplied `asp` wins. On a built `ScrapeConfig`, read it with
`unblocker_enabled()` and write it with `set_unblocker(bool)`
- Use `Format::Markdown` for clean, LLM-friendly content
- Read the page body via `result.result.content`; the upstream HTTP status is `result.result.status_code`
- The crate bundles no HTML parser — bring your own (`scraper`, `kuchiki`)
Wersje
W bazie nie ma innych skilli o nazwie scrapfly-sdk-rust.
Migawka bazy z 13.11.2026 · wersja paczki 6662bfcf59bd (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100scrapfly-sdk-go
Pobiera strony z programu w Go przez SDK Scrapfly: renderowanie JavaScript, zrzuty ekranu i wyciąganie danych. Przydaje się przy integracji scrapowania w aplikacji Go. - 100scrapfly-sdk-typescript
Pobiera strony z TypeScriptu lub JavaScriptu przez SDK Scrapfly na Node.js, Deno lub Bun, z renderowaniem i zrzutami. Przydaje się przy integracji scrapowania w aplikacji JS. - 100scrapfly-webhooks
Odbiera i weryfikuje webhooki Scrapfly dla asynchronicznych zadań scrape, ekstrakcji, zrzutów ekranu i crawlerów, sprawdza nagłówek X-Scrapfly-Webhook-Signature i kieruje po X-Scrapfly-Webhook-Resource-Type. - 86rust-review
Przegląda kod Rust, diff lub crate przed wdrożeniem i ocenia, czy jest poprawny oraz idiomatyczny. - 96ds-rust
Zmienia zachowanie crate w Rust, funkcje Cargo, cykle życia async i granice zależności natywnych w istniejącym projekcie. - 100rust-async-patterns
Opisuje programowanie asynchroniczne w Rust z Tokio: async traits, obsługę błędów i wzorce współbieżne, przy budowie aplikacji asynchronicznych i debugowaniu kodu async.