Ir al contenido
Iniciar sesión Registrarse

Forzar tiempos de espera

Algunas páginas mantienen unos pocos nodos DOM cargando durante bastante tiempo después de que el contenido principal esté listo. Utiliza el parámetro timeout para limitar el tiempo total de renderizado. La API devuelve el HTML que tenga disponible cuando salte el temporizador, o un 422 con un error explicativo si no se ha recopilado nada utilizable.

GET https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=<TARGET_URL>&render_js=1&timeout=<MILLISECONDS>
ParámetroTipoObligatorioDescripción
api_keystringTu clave de la Web Scraping API
urlstringURL de destino a obtener
timeoutintegernoTiempo máximo que el motor puede dedicar al renderizado, en milisegundos. Máximo 60000.
render_jsintegernoEstablece 1 para renderizar JavaScript.
Ventana de terminal
curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https%3A%2F%2Fhttpbin.org%2Fget&render_js=1&timeout=200"
{
"status": "Failure",
"status_code": 422,
"created_at": "2022-04-26T11:57:23.242Z",
"processed_at": "2022-04-26T11:57:23.739Z",
"time_taken": {
"total": 0.701,
"scraping": 0.202,
"setup_worker": 0.403
},
"error": "The target page took more than 0.2 seconds to load, the website might be down. Retry the request or increase the value of 'timeout' parameter.",
"page_content": null
}