Skip to content

Commit 84d06e6

Browse files
authored
Update scrape-endpoint.mdx
fix /scrape typescript example. + curl
1 parent 0c38c52 commit 84d06e6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/content/docs/browser-rendering/rest-api/scrape-endpoint.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-
2727
{
2828
"selector": "a"
2929
}]
30-
}'
30+
}
3131
```
3232
3333
```json output
@@ -74,13 +74,15 @@ curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-
7474
import Cloudflare from "cloudflare";
7575
7676
const client = new Cloudflare({
77-
apiEmail: process.env["CLOUDFLARE_EMAIL"], // This is the default and can be omitted
78-
apiKey: process.env["CLOUDFLARE_API_KEY"], // This is the default and can be omitted
77+
apiToken: process.env["CLOUDFLARE_API_TOKEN"],
7978
});
8079
8180
const scrapes = await client.browserRendering.scrape.create({
82-
account_id: "account_id",
83-
elements: [{ selector: "selector" }],
81+
account_id: process.env["CLOUDFLARE_ACCOUNT_ID"],
82+
elements: [
83+
{ selector: "h1" },
84+
{ selector: "a" }
85+
]
8486
});
8587
8688
console.log(scrapes);

0 commit comments

Comments
 (0)