Scrape examples
Static page
Static or article-style page
```bash
curl https://api.faircompany.ai/v1/crawl/web/scrape \
-X POST \
-H "Authorization: Bearer fc_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://stripe.com/pricing",
"format": "markdown",
"only_main_content": true
}'
```
```ts
import FairCrawl from "faircrawl";
const fc = new FairCrawl({ apiKey: process.env.FAIRCRAWL_API_KEY || "fc_live_xxx" });
const result = await fc.scrape({
url: "https://stripe.com/pricing",
format: "markdown",
only_main_content: true,
});
console.log(result.text);
console.log(result._meta.cost);
```
```python
from faircrawl import FairCrawl
fc = FairCrawl()
result = fc.scrape(
"https://stripe.com/pricing",
format="markdown",
only_main_content=True,
)
print(result.text)
print(result.meta.cost)
```
```json
{
"tool": "faircrawl_scrape",
"arguments": {
"url": "https://stripe.com/pricing",
"format": "markdown",
"only_main_content": true
}
}
```
JS-rendered page
Rendered page with screenshot
```bash
curl https://api.faircompany.ai/v1/crawl/web/scrape \
-X POST \
-H "Authorization: Bearer fc_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://app.linear.app/changelog",
"render_js": true,
"screenshot": true
}'
```
```ts
const page = await fc.scrape({
url: "https://app.linear.app/changelog",
render_js: true,
screenshot: true,
});
console.log(page.html);
console.log(page._meta.method);
```
```python
page = fc.scrape(
"https://app.linear.app/changelog",
render_js=True,
screenshot=True,
)
print(page.html)
print(page.meta.method)
```
```json
{
"tool": "faircrawl_scrape",
"arguments": {
"url": "https://app.linear.app/changelog",
"render_js": true,
"screenshot": true
}
}
```
PDF or DOCX
Document extraction
```bash
curl https://api.faircompany.ai/v1/crawl/web/scrape \
-X POST \
-H "Authorization: Bearer fc_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://www.ycombinator.com/companies.pdf",
"pdf_mode": "fast",
"max_pages": 5
}'
```
```ts
const pdf = await fc.scrape({
url: "https://www.ycombinator.com/companies.pdf",
pdf_mode: "fast",
max_pages: 5,
});
console.log(pdf.text);
console.log(pdf._meta.cost);
```
```python
pdf = fc.scrape(
"https://www.ycombinator.com/companies.pdf",
pdf_mode="fast",
max_pages=5,
)
print(pdf.text)
print(pdf.meta.cost)
```
```json
{
"tool": "faircrawl_scrape",
"arguments": {
"url": "https://www.ycombinator.com/companies.pdf",
"pdf_mode": "fast",
"max_pages": 5
}
}
```
Login and query-guided extraction
When you need session-aware reads, switch to /interact. When you only need a specific answer from a public page, keep the cheaper scrape path and add query.
curl https://api.faircompany.ai/v1/crawl/web/scrape \ -X POST \ -H "Authorization: Bearer $FAIRCRAWL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://stripe.com/pricing", "query": "Return just the standard card pricing section", "format": "markdown" }'