Obtener Texto del Primer Artículo de Noticias GDELT
Workflow manual que obtiene noticias públicas de GDELT y devuelve el texto extraído del primer artículo.
Descargar ZIP · 1.1 KB
Antes de Importar
Las URLs de este ejemplo usan un marcador de posición https://<your-gdelt-proxy> que debe reemplazar por un servicio que usted mismo aloje:
- Paso 1 llama a
<your-gdelt-proxy>/doccon parámetros de consulta de GDELT DOC 2.0 (query,mode=artlist,maxrecords,format=json) y espera una respuesta JSON con un arregloarticlesen el que cada artículo tiene unaurl. Esto coincide con lo que devuelve el endpoint público de GDELThttps://api.gdeltproject.org/api/v2/doc/doc, por lo que su proxy puede reenviar esta llamada tal cual. - Paso 2 llama a
<your-gdelt-proxy>/doc/contentcon un parámetrourly espera una respuesta JSON con un campotextque contiene el cuerpo extraído del artículo. La API pública de GDELT no tiene un endpoint de extracción de texto de artículos, por lo que su servicio debe implementar esta parte por sí mismo (por ejemplo, obteniendo la URL del artículo y extrayendo su texto legible).
Si solo necesita el listado de artículos sin el texto completo, consulte Obtener Noticias Públicas GDELT (String Codificada), que llama directamente a la API pública de GDELT.
JSON Completo
Clic para expandir
{
"description": "Manual workflow that fetches public GDELT news and returns the extracted text of the first article.",
"tags": [
"manual",
"http",
"news",
"gdelt",
"article-text",
"two-step"
],
"document": {
"name": "Fetch First GDELT News Article Text",
"enabled": true,
"log_level": "info",
"trigger": {
"type": "manual"
},
"workflowInput": [
{
"name": "query",
"description": "Search terms for GDELT public news (e.g., climate change, elections, ai policy)",
"schema": {
"type": "string",
"required": true
}
},
{
"name": "max_records",
"description": "Optional max number of news articles to consider (default: 50)",
"schema": {
"type": "string",
"required": false
}
}
],
"steps": [
{
"condition": {
"expr": "true",
"onFailure": "throw",
"resultType": "any"
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc\", {\"query\": query, \"mode\": \"artlist\", \"maxrecords\": coalesce(max_records, \"50\"), \"format\": \"json\"})",
"onFailure": "throw",
"resultType": "any"
},
"headers": [],
"returnBuffer": false,
"cache": true
}
}
},
{
"condition": {
"expr": "step_ok(0) && present(step_data(0, \"articles.0.url\"))",
"onFailure": "throw",
"resultType": "any"
},
"action": {
"actionType": "actions/network/http/request/send",
"actions/network/http/request/send": {
"method": "GET",
"url": {
"expr": "url_params(\"https://<your-gdelt-proxy>/doc/content\", {\"url\": step_data(0, \"articles.0.url\")})",
"onFailure": "throw",
"resultType": "any"
},
"headers": [],
"returnBuffer": false,
"cache": true
}
}
}
],
"returnExpression": {
"expr": "step_data(1, \"text\", \"\")",
"onFailure": "throw",
"resultType": "any",
"strict": false,
"useSimpleCel": false
},
"customAttributes": {}
}
}