FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
serpapi-javascript/examples/deno/pagination_example.ts at master · serpapi/serpapi-javascript · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
serpapi
/
serpapi-javascript
Public
Notifications
You must be signed in to change notification settings
Fork
28
Star
94
Code
Issues
7
Pull requests
8
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
serpapi-javascript
/
examples
/
deno
/
pagination_example.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
15 lines (13 loc) · 555 Bytes
Breadcrumbs
serpapi-javascript
/
examples
/
deno
/
pagination_example.ts
Copy path
File metadata and controls
15 lines (13 loc) · 555 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
import
{
loadSync
}
from
"https://deno.land/std@0.173.0/dotenv/mod.ts"
;
import
{
config
,
getJson
}
from
"../../mod.ts"
;
const
{
API_KEY
:
apiKey
}
=
loadSync
(
)
;
config
.
api_key
=
apiKey
;
// Get the first page
const
page
=
await
getJson
(
{
engine
:
"google"
,
q
:
"Coffee"
}
)
;
// Parse SerpApi search URL to the next page
const
nextUrl
=
new
URL
(
page
.
serpapi_pagination
.
next
)
;
// Extract the request parameters
const
nextParams
=
Object
.
fromEntries
(
nextUrl
.
searchParams
)
;
// Get the next page
const
nextPage
=
await
getJson
(
nextParams
)
;
console
.
log
(
nextPage
)
;
Back
|
FazBrowse Home
|
New Git URL