Collecting Cookies
get_cookies Functions
Websites may set cookies for a variety of purposes, from identifying returning users to storing user preference information.
Capturing and saving the cookies a website sends is easily done with Page Interactions using the get_cookies
function. get_cookies
accepts a timeout parameter to set how long to listen for new cookies, as demonstrated below:
Parameter
Required
Description
timeout
Optional
Default = 1000
Integer | Controls how long to wait for new cookies before storing all collected cookie data in ms.
Example Request
curl -X POST 'https://api.webit.live/api/v1/realtime/web' \
--header 'Authorization: Basic <credential string>' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "https://www.example.com",
"render": true,
"render_flow": [{
"get_cookies": {
"timeout": 1000
}
}]
}'
Like all Page Interactions, infinite scrolling is capped by the global 120-second session timeout, and will be terminated if this limit is reached.
Example Response
get_cookies
returns an array of cookies with a variety of relevant metadata, as shown in the example below:
...
"render_flow": {
"success": true,
"results": [
{
"name": "get_cookies",
"status": "done",
"duration": 2,
"result": [
{
"name": "AEC",
"value": "AQTF6HyAslt2IuPBg9jwM2zCXxNUpsNKGgNwuplQWREeFgCJ5xXjYer98As",
"domain": ".google.com",
"path": "/",
"expires": 1733227086.667467,
"size": 62,
"httpOnly": true,
"secure": true,
"session": false,
"sameSite": "Lax",
"priority": "Medium",
"sameParty": false,
"sourceScheme": "Secure",
"sourcePort": 443
},
{
"name": "receive-cookie-deprecation",
"value": "1",
"domain": "www.google.com",
"path": "/",
"expires": 1733227086.667547,
"size": 27,
"httpOnly": true,
"secure": true,
"session": false,
"sameSite": "None",
"priority": "Medium",
"sameParty": false,
"sourceScheme": "Secure",
"sourcePort": 443,
"partitionKey": "https://google.com"
},
{
"name": "NID",
"value": "514=lxnGqrzAmosD7_7PmQUW-pU4qmlkut0tglTMPm3_T98VEVTulM6PgQWJW8RA4ayo0GKh3pIEP4cOET0JOn56PR2-rPD9nSrNzD_uKid8WQ3s_-WNjXpGs68BFpqHCRRnwG9OZBMi3NeGUYe2gE7pmIL1mkV_ryQDDcgcicdlthU",
"domain": ".google.com",
"path": "/",
"expires": 1733486286.667576,
"size": 178,
"httpOnly": true,
"secure": true,
"session": false,
"sameSite": "None",
"priority": "Medium",
"sameParty": false,
"sourceScheme": "Secure",
"sourcePort": 443
}
]
}
]
}
Last updated