Device Type
If your use case requires you to exclusively use either Desktop or Mobile User Agents in the headers it sends to the target website, then you can use the device_type parameter to specify whether a Desktop or Mobile client is emulated.
Set
device_type=desktopto have the API set a desktop (e.g. iOS, Windows, or Linux) User Agent. Note: This is the default behavior. Not setting the parameter will have the same effect.Set
device_type=mobileto have the API set a mobile (e.g. iPhone or Android) User Agent.
Note: The device type you set will be overridden if you use keep_headers=true and send your own User Agent in the request headers.
API REQUEST
curl --request GET \
--url 'https://api.scraperapi.com?api_key=API_KEY&device_type=mobile&url=https://example.com/'import requests
target_url = 'https://example.com/'
# Replace the value for api_key with your actual API Key.
api_key = 'API_KEY'
request_url = (
f'https://api.scraperapi.com?'
f'api_key={api_key}'
f'&device_type=mobile'
f'&url={target_url}'
)
response = requests.get(request_url)
print(response.text)import request from 'node-fetch';
// Replace the value for api_key with your actual API Key.
const url = 'http://api.scraperapi.com/?api_key=API_KEY&device_type=mobile&url=https://example.com/';
request(url)
.then(response => {
console.log(response);
})
.catch(error => {
console.error(error);
});ASYNC REQUEST
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"apiKey": "API_KEY",
"url": "https://example.com/",
"apiParams": {
"device_type": "mobile"
}
}' \
"https://async.scraperapi.com/jobs"import requests
r = requests.post(
url='https://async.scraperapi.com/jobs',
json={
# Replace the value for api_key with your actual API Key.
'apiKey': 'API_KEY',
'device_type': 'mobile',
'url': 'https://example.com/'
}
)
print(r.text)PROXY MODE

