FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
scrapegraph-js/examples/scrape/scrape_basic.ts at main · ScrapeGraphAI/scrapegraph-js · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ScrapeGraphAI
/
scrapegraph-js
Public
Notifications
You must be signed in to change notification settings
Fork
7
Star
6
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
scrapegraph-js
/
examples
/
scrape
/
scrape_basic.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (13 loc) · 450 Bytes
Breadcrumbs
scrapegraph-js
/
examples
/
scrape
/
scrape_basic.ts
Copy path
File metadata and controls
16 lines (13 loc) · 450 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import
{
ScrapeGraphAI
}
from
"scrapegraph-js"
;
// reads SGAI_API_KEY from env, or pass explicitly: ScrapeGraphAI({ apiKey: "..." })
const
sgai
=
ScrapeGraphAI
(
)
;
const
res
=
await
sgai
.
scrape
(
{
url
:
"https://example.com"
,
formats
:
[
{
type
:
"markdown"
}
]
,
}
)
;
if
(
res
.
status
===
"success"
)
{
console
.
log
(
"Markdown:"
,
res
.
data
?.
results
.
markdown
?.
data
)
;
console
.
log
(
`\nTook
${
res
.
elapsedMs
}
ms`
)
;
}
else
{
console
.
error
(
"Failed:"
,
res
.
error
)
;
}
Back
|
FazBrowse Home
|
New Git URL