Device Type
device_type: string | null;
What's This?
The device_type option lets you tell the scraper to act like a specific device when visiting a website. Websites often look different on a phone compared to a computer, and this option helps you see the version you want.
How Does it Work?
-
(device_type=‘desktop’): The request emulates a desktop device.
-
(device_type=’mobile’): The request emulates a mobile device.
-
(device_type=’tablet’): The request emulates a tablet device.
-
Default (device_type=null).
When Should I Use This?
If you want to see how a website looks and behaves on different devices, use the device_type option. Some websites show different things or arrange content differently depending on the device, so this option helps you capture the exact version you're interested in.
Methods
setDeviceType(string)
Configuration Name: device_type
Initializing Scraper
const GeonodeScraperApi = require('geonode-scraper-api');
const scraper = new GeonodeScraperApi('<Your_username>', '<Your_password>');
Using Method
scraper.setDeviceType('desktop');
scraper.scrape('https://example.com/');
Using Configuration Object
scraper.setDeviceType('desktop');
scraper.scrape('https://example.com/');