### Incogniton Client: Profile Management Example Source: https://api-docs.incogniton.com/sdks/nodejs Example demonstrating Incogniton Client usage for profile lifecycle management, including creation, listing, getting, launching, and stopping profiles. Requires the Incogniton desktop app to be running. ```typescript import { IncognitonClient } from 'incogniton' const client = new IncognitonClient() // Create a profile const created = await client.profile.add({ profileData: { name: 'My Profile', // ...other fields }, }) // List profiles const profiles = await client.profile.list() // Get a specific profile const profileId = 'your_profile_id' const profile = await client.profile.get(profileId) // Launch (starts a local, profile-bound browser) await client.profile.launch(profileId) // Stop when done await client.profile.stop(profileId) // ESM assumes "type": "module" — for CommonJS, wrap "await" in an async function. ``` -------------------------------- ### Install Prisma & Client Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Install Prisma and the Prisma-Client by running this command in your terminal. This is the first step to setting up Prisma for database management. ```bash npm install prisma @prisma/client ``` -------------------------------- ### Install Puppeteer Core Source: https://api-docs.incogniton.com/how-to-guides/scraping-with-Incogniton Install the puppeteer-core library, which is recommended for connecting to existing browser instances like Incogniton as it does not bundle Chromium. ```bash npm install puppeteer-core ``` -------------------------------- ### Install Python SDK using pip Source: https://api-docs.incogniton.com/sdks/python Install the Incogniton Python SDK using pip. Ensure you have Python 3.8+ installed. ```bash pip install incogniton ``` -------------------------------- ### Run export-starter.js Script Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Execute the starter script to set up the project for data export. Ensure Node.js is installed. ```bash node export-starter.js ``` -------------------------------- ### Example Scraped Product Data Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping This is an example of the expected output format for scraped product data, showing an array of objects with 'name' and 'price' properties. ```javascript products -> [ { name: 'A Light in the ...', 'price: '£51.77' }, { name: 'Tipping the Velvet', price: '£53.74' }, { name: 'Soumission', price: '£50.10' }, { name: 'Sharp Objects', price: '£47.82' }, // other products on the page... ] ``` -------------------------------- ### GET /profile/launch/{profile_id}/force/local Source: https://api-docs.incogniton.com/apis Launches a browser profile and forces synchronization using the latest local backup. ```APIDOC ## GET /profile/launch/{profile_id}/force/local ### Description Launches a browser profile and forces synchronization using the latest local backup. It helps solve out-of-sync or related browser profile issues. ### Method GET ### Endpoint /profile/launch/{profile_id}/force/local ### Parameters #### Path Parameters - **profile_id** (string) - Required - The browser profile ID. ### Response #### Success Response (200) - **message** (string) - Confirmation message, e.g., 'Profile launched'. - **status** (string) - Indicates the status of the operation, typically 'ok'. #### Response Example ```json { "message": "Profile launched", "status": "ok" } ``` ``` -------------------------------- ### Install Scraping Dependencies Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Install the necessary npm packages for web scraping: cheerio for HTML parsing and user-agents for user-agent rotation. ```bash npm install cheerio user-agents ``` -------------------------------- ### Install Incogniton Node.js SDK Source: https://api-docs.incogniton.com/getting-started/quickstart Install the Incogniton SDK for Node.js using npm. This is the first step to using the Incogniton API with TypeScript or JavaScript. ```bash npm install incogniton ``` -------------------------------- ### GET /profile/launch/{profile_id} Source: https://api-docs.incogniton.com/apis Initiates the launch of a specific browser profile. ```APIDOC ## GET /profile/launch/{profile_id} ### Description This endpoint initiates the launch of a specific browser profile. It starts the profile session using the configuration specified in your settings. ### Method GET ### Endpoint /profile/launch/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile to launch. ### Response #### Success Response (200) - **message** (string) - Confirmation message, e.g., 'Profile launched'. - **status** (string) - Indicates the status of the operation, typically 'ok'. #### Response Example ```json { "message": "Profile launched", "status": "ok" } ``` ``` -------------------------------- ### GET /profile/launch/{profile_id}/force/cloud Source: https://api-docs.incogniton.com/apis Launches a browser profile and forces synchronization using the latest cloud backup. ```APIDOC ## GET /profile/launch/{profile_id}/force/cloud ### Description Launches a browser profile and forces synchronization using the latest cloud backup. It helps solve out-of-sync or similar browser profile issues. ### Method GET ### Endpoint /profile/launch/{profile_id}/force/cloud ### Parameters #### Path Parameters - **profile_id** (string) - Required - The browser profile ID. ### Response #### Success Response (200) - **message** (string) - Confirmation message, e.g., 'Profile launched'. - **status** (string) - Indicates the status of the operation, typically 'ok'. #### Response Example ```json { "message": "Profile launched", "status": "ok" } ``` ``` -------------------------------- ### Incogniton Browser: Playwright Automation Example Source: https://api-docs.incogniton.com/sdks/nodejs Example of using IncognitonBrowser to attach Playwright to a running Incogniton profile's browser via CDP. Ensures the profile's browser is launched before starting the controller. ```typescript import { IncognitonClient, IncognitonBrowser } from 'incogniton' const client = new IncognitonClient() const profileId = 'your-profile-id' // Ensure the profile's browser is running await client.profile.launch(profileId) // Controller bound to that profile const browser = new IncognitonBrowser({ profileId, headless: true, }) // Establish CDP session → Playwright Browser const pwBrowser = await browser.startPlaywright() const page = await pwBrowser.newPage() await page.goto('https://example.com') await page.screenshot({ path: 'example.png' }) // Clean shutdown (frees resources) await browser.close(pwBrowser) // Optionally stop the profile/browser await client.profile.stop(profileId) ``` -------------------------------- ### Get Profile Information Source: https://api-docs.incogniton.com/apis Retrieves detailed data for a specified browser profile. Ensure the 'incogniton' package is installed. ```Node.js import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.get("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Example Output of Scraped Quotes Source: https://api-docs.incogniton.com/how-to-guides/scraping-with-Incogniton This is an example of the data structure you can expect after successfully scraping quotes and authors from the dynamically rendered page. ```json Extracted Quotes -> [ { text: '"The world as we have created it is a process of our thinking. It cannot be changed without changing our thinking."', author: 'Albert Einstein' }, { text: '"It is our choices, Harry, that show what we truly are, far more than our abilities."', author: 'J.K. Rowling' }, { text: '"The person, be it gentleman or lady, who has not pleasure in a good novel, must be intolerably stupid."', author: 'Jane Austen' }, // other quotes... ] ``` -------------------------------- ### Sample JSON Output Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Example structure of a JSON file generated from scraped data, containing product names and prices. ```json [ { "name": "A Light in the ...", "price": "£51.77" }, { "name": "Tipping the Velvet", "price": "£53.74" }, { "name": "Soumission", "price": "£50.10" }, { "name": "Sharp Objects", "price": "£47.82" } // other products... ] ``` -------------------------------- ### Insert Data into Database with Prisma Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Use the Prisma Client to create a new record in your database. This example inserts a 'Sample Item' with a price and then queries all stored data. Ensure Prisma Client is properly initialized and connected. ```javascript async function run() { await prisma.scrapedData.create({ data: { name: 'Sample Item', price: '$20.99', }, }) console.log('Data inserted successfully') // Optionally, query and log all records const data = await prisma.scrapedData.findMany() console.log('Stored data:', data) } run() .catch((e) => console.error(e)) .finally(() => prisma.$disconnect()) ``` -------------------------------- ### Scraped Product Data Output Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Example output showing the extracted name and price of the last product scraped from the webpage. ```json lastProduct-> { name: "It's Only the Himalayas", price: "£45.17" }; ``` -------------------------------- ### Example User Agent String Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping A typical user agent string identifies the client's software and device details, simulating requests from various browsers and devices. ```text Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 ``` -------------------------------- ### GET /automation/launch/puppeteer/{profile_id} Source: https://api-docs.incogniton.com/apis Launches an automated Puppeteer browser session using a specific profile. ```APIDOC ## Launch Puppeteer Default ### Description This endpoint launches an automated Puppeteer browser session using a specific profile. The profile ID is passed as a URL parameter so that the server can retrieve the corresponding browser configuration. ### Method GET ### Endpoint /automation/launch/puppeteer/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile to be launched. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the status of the launch. - **status** (string) - The status of the operation, e.g., "ok". #### Response Example ```json { "message": "Browser session launched successfully", "status": "ok" } ``` ``` -------------------------------- ### GET /profile/all Source: https://api-docs.incogniton.com/apis Retrieves a comprehensive list of all browser profiles associated with your account. ```APIDOC ## GET /profile/all ### Description Retrieve a comprehensive list of all browser profiles associated with your account. ### Method GET ### Endpoint /profile/all ### Response #### Success Response (200) - **profiles** (array) - A list of all browser profiles. #### Response Example (Example response structure would be detailed here if provided in the source text) ``` -------------------------------- ### List All Profiles using Node.js Source: https://api-docs.incogniton.com/apis Retrieve a list of all browser profiles. This requires the 'incogniton' package to be installed. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.list(); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### IncognitonBrowser Methods Source: https://api-docs.incogniton.com/sdks/nodejs Methods for starting and closing browser instances for Playwright and Selenium. ```APIDOC ## `IncognitonBrowser` Methods ### Description Use Incogniton Browser to attach Playwright/Puppeteer/Selenium to a running, profile-bound browser. Prefer reusing a single controller per worker. ### Configuration Options - `profileId` (string) - Required - Which Incogniton profile to launch/attach. - `headless` (boolean) - Optional - Run without a visible window (default `false`). - `customArgs` (array) - Optional - Extra Chromium flags (e.g. `--no-sandbox`). - `launchTimeout` (integer) - Optional - Max time to wait for readiness (ms). ### Methods - `browser.start_playwright` - **Description**: Return a connected Playwright `Browser` (CDP). - **Method**: POST (assumed) - **Endpoint**: `/browser/playwright/start` (assumed) - **Request Body**: - `profileId` (string) - Required - The ID of the profile. - `headless` (boolean) - Optional - Run headless. - `customArgs` (array) - Optional - Custom arguments. - `launchTimeout` (integer) - Optional - Launch timeout. - `browser.start_selenium` - **Description**: Return a connected Selenium `WebDriver`. - **Method**: POST (assumed) - **Endpoint**: `/browser/selenium/start` (assumed) - **Request Body**: - `profileId` (string) - Required - The ID of the profile. - `headless` (boolean) - Optional - Run headless. - `customArgs` (array) - Optional - Custom arguments. - `launchTimeout` (integer) - Optional - Launch timeout. - `browser.close` - **Description**: Close a single Playwright browser instance. - **Method**: POST (assumed) - **Endpoint**: `/browser/close` (assumed) - **Request Body**: - `profileId` (string) - Required - The ID of the profile. - `browser.close_all` - **Description**: Close multiple Playwright instances in parallel. - **Method**: POST (assumed) - **Endpoint**: `/browser/close_all` (assumed) ``` -------------------------------- ### Launch a browser profile Source: https://api-docs.incogniton.com/apis Initiates the launch of a specific browser profile using its unique ID. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.launch("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Example Response for Deleting Cookies Source: https://api-docs.incogniton.com/apis This JSON indicates the successful deletion of cookies from a profile. ```json { "message": "Cookies successfully deleted", "status": "ok" } ``` -------------------------------- ### Launch Selenium Custom with Node.js Source: https://api-docs.incogniton.com/apis Launches a Selenium browser session with a profile ID and custom arguments. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.automation.launchSeleniumCustom("PROFILE_ID", ); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Launch Selenium Default with Node.js Source: https://api-docs.incogniton.com/apis Launches a Selenium browser session using a profile ID. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.automation.launchSelenium("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### GET /profile/force-stop/{profile_id} Source: https://api-docs.incogniton.com/apis Forcefully stops a launched profile, terminating all associated processes and connections. ```APIDOC ## GET /profile/force-stop/{profile_id} ### Description Forcefully stops a launched profile, terminating all associated processes and connections. ### Method GET ### Endpoint /profile/force-stop/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The browser profile ID ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **status** (string) - Status indicator. #### Response Example ```json { "message": "Profile forcefully stopped", "status": "ok" } ``` ``` -------------------------------- ### GET /profile/status/{profile_id} Source: https://api-docs.incogniton.com/apis Returns the current status of a specific profile, which may be `ready`, `launching`, `launched`, `syncing`, `synced`, etc. ```APIDOC ## GET /profile/status/{profile_id} ### Description Returns the current status of a specific profile, which may be `ready`, `launching`, `launched`, `syncing`, `synced`, etc. ### Method GET ### Endpoint /profile/status/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile for which the status is retrieved. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **status** (string) - The current status of the profile. #### Response Example ```json { "status": "Ready" } ``` ``` -------------------------------- ### Add a new browser profile Source: https://api-docs.incogniton.com/apis Creates a new browser profile with specified configuration. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.add({ "profile_name": "New Profile", "platform": "windows", "userAgent": "Mozilla/5.0" }); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Launch profile with forced local sync Source: https://api-docs.incogniton.com/apis Launches a browser profile and forces synchronization with the latest local backup to resolve sync issues. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.launchForceLocal("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Launch profile with forced cloud sync Source: https://api-docs.incogniton.com/apis Launches a browser profile and forces synchronization with the latest cloud backup to resolve sync issues. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.launchForceCloud("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Get Profile Information Source: https://api-docs.incogniton.com/sdks/python Retrieve details for a specific profile, list all available profiles, and check the status of a profile. All operations are asynchronous. ```python import asyncio from incogniton import IncognitonClient async def main(): client = IncognitonClient() pid = "your-profile-id" profile = await client.profile.get(pid) print(profile.get("name"), profile.get("id")) all_profiles = await client.profile.list() print("Total:", len(all_profiles)) status = await client.profile.get_status(pid) print("Status:", status) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Browser Automation with Playwright Source: https://api-docs.incogniton.com/sdks/python Automate browser actions using Playwright by attaching to a running Incogniton profile. This example navigates to a URL and takes a screenshot. Ensure the Incogniton app is running. ```python import asyncio from incogniton import IncognitonBrowser async def main(): profile_id = "your-profile-id" browser = IncognitonBrowser(profile_id=profile_id, headless=True) pw_browser = await browser.start_playwright() page = await pw_browser.new_page() await page.goto("https://example.com") await page.screenshot(path="example.png") print("Screenshot saved as example.png") await browser.close(pw_browser) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### GET /automation/launch/python/{profile_id} Source: https://api-docs.incogniton.com/apis Launches an automated Selenium browser session using a specific profile. The profile ID is provided as a URL parameter so that the server can retrieve the corresponding browser configuration and initiate the session with default Python settings. ```APIDOC ## GET /automation/launch/python/{profile_id} ### Description Launches an automated Selenium browser session using a specific profile. The profile ID is provided as a URL parameter so that the server can retrieve the corresponding browser configuration and initiate the session with default Python settings. ### Method GET ### Endpoint /automation/launch/python/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile to be launched with Selenium. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **puppeteerUrl** (string) - The URL for the Puppeteer session. - **status** (string) - The status of the operation. #### Response Example ```json { "puppeteerUrl": "http://127.0.0.1:60128", "status": "ok" } ``` ``` -------------------------------- ### Launch Puppeteer Custom with Node.js Source: https://api-docs.incogniton.com/apis Launches a Puppeteer browser session with a profile ID and custom arguments. Ensure you have installed the 'incogniton' package. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.automation.launchPuppeteerCustom("PROFILE_ID", ); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Fetch HTML Content with Node.js Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Use this async function to send a GET request to a URL, retrieve its HTML content as text, and log it to the console. Includes basic error handling. ```javascript const fetchStaticData = async () => { try { // Send GET request to fetch website data const PAGE_URL = 'https://books.toscrape.com/' const response = await fetch(PAGE_URL) // Extract text data from the response const data = await response.text() // Log the extracted data console.log(data) } catch (error) { // Handle errors console.error('Error fetching Data ->', error) } } fetchStaticData() ``` -------------------------------- ### Launch Puppeteer Session (Node.js) Source: https://api-docs.incogniton.com/apis This Node.js code launches an automated Puppeteer browser session using a specified profile. Install the 'incogniton' package before running. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.automation.launchPuppeteer("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### GET /profile/get/{profile_id} Source: https://api-docs.incogniton.com/apis Retrieves detailed profile data including timezone, general info, geolocation, navigator settings, media devices, fonts, extensions, proxy, customDNS, hardware, WebRTC configuration, and other custom options, with a status indicator. ```APIDOC ## GET /profile/get/{profile_id} ### Description Returns detailed profile data including timezone, general info, geolocation, navigator settings, media devices, fonts, extensions, proxy, customDNS, hardware, WebRTC configuration, and other custom options, with a status indicator. ### Method GET ### Endpoint /profile/get/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The browser profile ID ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **profileData** (object) - Detailed profile data - **status** (string) - Status indicator #### Response Example ```json { "profileData": { "Timezone": { "fill_timezone_based_on_ip": "true", "timezone_offset": "-05:00", "timezone_name": "America/Indiana/Vincennes" }, "general_profile_information": { "profile_browser_version": "131", "simulated_operating_system": "mac", "profile_name": "Profile 1", "profile_notes": "", "profile_group": "Unassigned", "profile_last_edited": "2025-02-04" }, "Geolocation": { "fill_geolocation_based_on_ip": "true", "behavior": "Prompt", "location_information": { "latitude": "41.88", "accuracy": "2501.0", "longitude": "-86.31" } }, "Navigator": { "navigator_languageIPToggle": true, "hardware_concurrency": "SIX", "languages": "en_US", "do_not_track": false, "screen_resolution": "1600x900", "navigator_useragent_always_latest": true, "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.6778.139 Safari/537.36", "platform": "MacIntel", "navigator_deviceMemory": "8", "navigator_useragent_match_chrome_core": false }, "Media_devices": { "audio_outputs": 3, "video_outputs": 3, "enable_media_masking": "true", "audio_inputs": 3 }, "Fonts": { "enable_font_list_masking": "true", "enable_unicode_glyps_domrect": "false" }, "Extensions": { "contains_extensions": "false" }, "UnblockedFreeProxySettings": { "unblocked_free_proxy_country": "US", "unblocked_free_proxy_enabled": true }, "Proxy": { "connection_type": "Without proxy", "proxy_rotation_api_url": "", "proxy_rotating": 0, "proxy_provider": "main-ipinfo", "proxy_url": "" }, "CustomDNS": { "customDNS_enabled": "false", "customDNS_details": "" }, "Hardware": { "WebGL": { "WebGL_meta": { "WebGL_meta_behavior": "Mask" }, "WebGL_image": { "WebGL_behavior": "Off" } }, "Canvas": { "Canvas_behavior": "Off" }, "AudioContext": { "Audio_Context_behavior": "Noise" } }, "WebRTC": { "behavior": "Altered", "set_external_ip": true }, "Other": { "browser_allowRealMediaDevices": "false", "other_try_to_pass_iphey": "false", "active_session_lock": "true", "other_ShowProfileName": "true", "custom_browser_args_enabled": "false", "browser_language_lock": "true", "custom_browser_language": "", "custom_browser_args_string": "", "other_doNotShowChromeSettings": "false" } }, "status": "ok" } ``` ``` -------------------------------- ### Automate Browser with Incogniton and Playwright Source: https://api-docs.incogniton.com/getting-started/quickstart Perform browser automation tasks using the Incogniton Browser Automation SDK with Playwright. This example launches a profile, navigates to a URL, takes a screenshot, and closes the browser. The `headless` option is set to `true`. ```typescript import { IncognitonBrowser } from 'incogniton'; const profileId = 'your-profile-id'; // Create a browser automation instance const browser = new IncognitonBrowser({ headless: true }); // Launch a Playwright browser instance const playwrightBrowser = await browser.startPlaywright(); // Open a new page and navigate const page = await playwrightBrowser.newPage(); await page.goto('https://example.com'); // Take a screenshot await page.screenshot({ path: 'example.png' }); // Close the browser when done await browser.close(playwrightBrowser); ``` -------------------------------- ### Example Cookie Data Response Source: https://api-docs.incogniton.com/apis This JSON structure represents the data returned when exporting cookies from a profile. It includes details for each cookie such as path, domain, name, and security flags. ```json { "CookieData": [ { "path": "/", "session": false, "domain": ".example.com", "hostOnly": false, "sameSite": "no_restriction", "name": "SESSION_ID", "httpOnly": true, "secure": true, "value": "generic-session-id", "expirationDate": 1760000000 }, { "path": "/", "session": false, "domain": "auth.example.org", "hostOnly": true, "sameSite": "unspecified", "name": "user_token", "httpOnly": false, "secure": true, "value": "generic-user-token", "expirationDate": 1780000000 }, { "path": "/", "session": false, "domain": "auth.example.org", "hostOnly": true, "sameSite": "unspecified", "name": "device_id", "httpOnly": false, "secure": true, "value": "generic-device-id", "expirationDate": 1780000000 }, { "path": "/", "session": false, "domain": ".generic-site.net", "hostOnly": false, "sameSite": "no_restriction", "name": "auth_token", "httpOnly": false, "secure": true, "value": "generic-auth-token-1", "expirationDate": 1755000000 }, { "path": "/", "session": false, "domain": ".generic-site.eu", "hostOnly": false, "sameSite": "no_restriction", "name": "auth_token", "httpOnly": false, "secure": true, "value": "generic-auth-token-2", "expirationDate": 1755000000 }, { "path": "/", "session": false, "domain": "www.generic-site.net", "hostOnly": true, "sameSite": "unspecified", "name": "session_key", "httpOnly": false, "secure": false, "value": "generic-session-key", "expirationDate": 1765000000 }, { "path": "/", "session": false, "domain": ".www.generic-site.net", "hostOnly": false, "sameSite": "unspecified", "name": "cache_data", "httpOnly": false, "secure": true, "value": "{\"expire\":1760000000,\"items\":[\"item1\",\"item2\"]}", "expirationDate": 1760000000 }, { "path": "/", "session": false, "domain": ".www.generic-site.net", "hostOnly": false, "sameSite": "unspecified", "name": "theme", "httpOnly": false, "secure": true, "value": "light", "expirationDate": 1770000000 }, { "path": "/", "session": false, "domain": ".www.generic-site.net", "hostOnly": false, "sameSite": "unspecified", "name": "theme_source", "httpOnly": false, "secure": true, "value": "manual", "expirationDate": 1770000000 }, { "path": "/", "session": false, "domain": ".generic-site.net", "hostOnly": false, "sameSite": "unspecified", "name": "chain_token", "httpOnly": true, "secure": true, "value": "generic-chain-token", "expirationDate": 1760000000 }, { "path": "/", "session": false, "domain": ".generic-site.net", "hostOnly": false, "sameSite": "lax", "name": "csrf_token", "httpOnly": true, "secure": true, "value": "generic-csrf-token", "expirationDate": 0 }, { "path": "/", "session": false, "domain": ".generic-site.net", "hostOnly": false, "sameSite": "no_restriction", "name": "tracking_id", "httpOnly": true, "secure": true, "value": "generic-tracking-id", "expirationDate": 1780000000 } ], "message": "Successfully exported cookies", "status": "ok" } ``` -------------------------------- ### Get Profile Status Source: https://api-docs.incogniton.com/apis Fetches the current operational status of a browser profile. Requires the 'incogniton' package to be installed. ```Node.js import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.getStatus("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Navigate into Project Directory Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Change your current directory to the newly created project folder. ```bash cd anonymous-scraper ``` -------------------------------- ### Initialize Node.js Project Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Initialize a new Node.js project with default settings. This creates a package.json file to manage dependencies. ```bash npm init -y ``` -------------------------------- ### Get Cookie from Profile using Node.js Source: https://api-docs.incogniton.com/apis Retrieves cookie data for a specific Incogniton profile. The response includes a 'CookieData' array with cookie details. Ensure the 'incogniton' package is installed. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.cookie.get("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### POST /profile/add Source: https://api-docs.incogniton.com/apis Creates a new browser profile with specified configuration details. ```APIDOC ## POST /profile/add ### Description Creates a new browser profile using the provided configuration details, including general profile information, proxy settings, timezone, WebRTC, navigator settings, and other options. ### Method POST ### Endpoint /profile/add ### Request Body - **profileData** (object) - Required - An object containing all configuration settings required to create or update a browser profile, including general information, proxy, timezone, WebRTC, navigator, and additional custom options. ### Request Example ```json { "profile_name": "New Profile", "platform": "windows", "userAgent": "Mozilla/5.0" } ``` ### Response #### Success Response (200) - **profile_browser_id** (string) - The unique identifier of the newly created profile. - **status** (string) - Indicates the status of the operation, typically 'ok'. #### Response Example ```json { "profile_browser_id": "e06d24a7-ccd2-456e-86d4-1e8a572bfae5", "status": "ok" } ``` ``` -------------------------------- ### Sample MySQL Connection String Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data This is the typical format for a MySQL connection URL. Replace USER, PASSWORD, HOST, PORT, and DATABASE_NAME with your specific database credentials. ```sql mysql://USER:PASSWORD@HOST:PORT/DATABASE_NAME ``` -------------------------------- ### POST /automation/launch/python/{profile_id}/ Source: https://api-docs.incogniton.com/apis Launches a Selenium-controlled browser session with custom command-line arguments, allowing modifications like headless mode while preserving the specified profile's browsing environment. ```APIDOC ## POST /automation/launch/python/{profile_id}/ ### Description Launches a Selenium-controlled browser session with custom command-line arguments, allowing modifications like headless mode while preserving the specified profile's browsing environment. ### Method POST ### Endpoint /automation/launch/python/{profile_id}/ ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile to be used for launching the session. #### Request Body - **customArgs** (string) - Optional - Custom command-line arguments for launching the browser, such as enabling headless mode. ### Request Example ```json { "customArgs": "--headless" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the operation. #### Response Example ```json { "status": "ok" } ``` ``` -------------------------------- ### GET /profile/stop/{profile_id} Source: https://api-docs.incogniton.com/apis Stops a launched profile. ```APIDOC ## GET /profile/stop/{profile_id} ### Description Stops a launched profile. ### Method GET ### Endpoint /profile/stop/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The browser profile ID ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **status** (string) - Status indicator. #### Response Example ```json { "message": "Profile stopped", "status": "ok" } ``` ``` -------------------------------- ### Sample .env File for Database URL Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Store your sensitive database connection string in a .env file as an environment variable named DATABASE_URL. Ensure the SQL database server is running and credentials are correct. ```dotenv DATABASE_URL=mysql://USER:PASSWORD@HOST:PORT/DATABASE_NAME ``` -------------------------------- ### Stop a Profile Source: https://api-docs.incogniton.com/apis Gracefully stops a running browser profile. Make sure to install the 'incogniton' package. ```Node.js import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.stop("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Apply Prisma Schema Migrations Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Run this command to apply your defined schema changes to the database. If migration errors occur, try running 'npx prisma generate' to ensure Prisma is properly initialized. ```bash npx prisma migrate dev --name init ``` -------------------------------- ### Initialize Prisma Client Source: https://api-docs.incogniton.com/how-to-guides/export-scraped-data Import and instantiate the PrismaClient in your Node.js application to interact with your database. This is the first step before performing database operations. ```javascript const { PrismaClient } = require('@prisma/client'); const prisma = new PrismaClient(); ``` -------------------------------- ### Create Project Directory Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Use this command to create a new folder for your anonymous scraping project. ```bash mkdir anonymous-scraper ``` -------------------------------- ### GET /profile/deleteCookie/{profile_id} Source: https://api-docs.incogniton.com/apis Remove all stored cookies associated with the specified profile, ensuring a clean browsing session. ```APIDOC ## Delete cookies from profile ### Description Remove all stored cookies associated with the specified profile, ensuring a clean browsing session. ### Method GET ### Endpoint /profile/deleteCookie/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile whose cookies will be deleted. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **message** (string) - Indicates the status of the operation. - **status** (string) - The status of the operation, e.g., "ok". #### Response Example ```json { "message": "Cookies successfully deleted", "status": "ok" } ``` ``` -------------------------------- ### Launch Browser Profile via Incogniton SDK Source: https://api-docs.incogniton.com/getting-started/quickstart Launch a browser profile using the Incogniton SDK for Node.js. This initializes an Incogniton browser instance with the specified profile. Ensure you have the Incogniton desktop app running. ```typescript import { IncognitonClient } from 'incogniton'; const client = new IncognitonClient(); const profileId = 'your-profile-id'; await client.profile.launch(profileId); ``` -------------------------------- ### Force Stop a Profile Source: https://api-docs.incogniton.com/apis Forcefully terminates a launched browser profile and all its associated processes. Ensure the 'incogniton' package is installed. ```Node.js import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.forceStop("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### Scrape Multiple Product Elements Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Use the .each() method to loop through product elements and extract name and price. Ensure Cheerio is imported and HTML is parsed. ```javascript const fetchStaticData = async () => { try { // fetch and parse HTML with cheerio... // Extract all product data from the first page const selectors = { name: 'article > h3 > a', price: 'p.price_color' } const productElement = $('.product_pod') // create a products array const products = [] productElement.each(function () { const name = $(this).find(selectors.name).text() const price = $(this).find(selectors.price).text() products.push({ name, price }) }) console.log('products ->', products) } catch (error) { // Handle errors console.error('Error scraping Data -->', error) } } ``` -------------------------------- ### Launch Incogniton Browser (Headless) Source: https://api-docs.incogniton.com/how-to-guides/scraping-with-Incogniton Configure the Incogniton launch request to use headless mode by including the `customArgs` parameter. This is optimized for large-scale scraping operations. ```javascript // Headless launch const startIncogniton = async ({ profileId }) => { try { const launchUrl = `http://localhost:35000/automation/launch/puppeteer`; const requestBody = { profileID: profileId, customArgs: '--headless=new', // use headless mode }; // Rest of the function remains the same... } }; ``` -------------------------------- ### Delete a Profile using Node.js Source: https://api-docs.incogniton.com/apis Removes a specified Incogniton profile. This action is irreversible. Ensure the 'incogniton' package is installed. ```javascript import { IncognitonClient } from "incogniton"; const client = new IncognitonClient(); const run = async () => { const response = await client.profile.delete("PROFILE_ID"); console.log(response); }; run(); // Don't forget to run "npm install incogniton" ``` -------------------------------- ### POST /automation/launch/puppeteer Source: https://api-docs.incogniton.com/apis Launches a Puppeteer-controlled browser session using a specified profile. This allows automation of browsing tasks with a customized environment, including custom command-line arguments such as headless mode. ```APIDOC ## POST /automation/launch/puppeteer ### Description Launches a Puppeteer-controlled browser session using a specified profile. This allows automation of browsing tasks with a customized environment, including custom command-line arguments such as headless mode. ### Method POST ### Endpoint /automation/launch/puppeteer ### Parameters #### Request Body - **profileID** (string) - Required - The unique identifier of the profile to be used for launching the session. - **customArgs** (string) - Optional - Custom command-line arguments for launching the browser, such as enabling headless mode. ### Request Example ```json { "profileID": "PROFILE_ID", "customArgs": "--headless" } ``` ### Response #### Success Response (200) - **puppeteerUrl** (string) - The URL for the Puppeteer session. - **status** (string) - The status of the operation. #### Response Example ```json { "puppeteerUrl": "http://127.0.0.1:60128", "status": "ok" } ``` ``` -------------------------------- ### Create Scraper File Source: https://api-docs.incogniton.com/how-to-guides/beginners-guide-to-scraping Create a new JavaScript file for your web scraper. This file will contain the scraping logic. ```bash touch anon-scraper1.js ``` -------------------------------- ### Get Cookie from profile Source: https://api-docs.incogniton.com/apis Retrieves cookie data associated with a specific profile. The response returns a JSON object containing a `CookieData` array. ```APIDOC ## GET /profile/cookie/{profile_id} ### Description Retrieves cookie data associated with a specific profile. The response returns a JSON object containing a `CookieData` array with one or more cookie entries. ### Method GET ### Endpoint /profile/cookie/{profile_id} ### Parameters #### Path Parameters - **profile_id** (string) - Required - The unique identifier of the profile whose cookie data is being retrieved. ### Request Example ```json { "profile_id": "PROFILE_ID" } ``` ### Response #### Success Response (200) - **CookieData** (array) - An array of cookie objects, each containing cookie details. #### Response Example ```json { "CookieData": [ { "name": "example_cookie", "value": "cookie_value", "domain": ".example.com", "path": "/", "expires": 1678886400, "httpOnly": false, "secure": true, "sameSite": "Lax" } ] } ``` ```