{"id":418,"date":"2025-06-03T14:19:30","date_gmt":"2025-06-03T12:19:30","guid":{"rendered":"https:\/\/hdplayer.es\/?page_id=418"},"modified":"2025-06-03T14:19:31","modified_gmt":"2025-06-03T12:19:31","slug":"tiempo","status":"publish","type":"page","link":"https:\/\/hdplayer.es\/index.php\/tiempo\/","title":{"rendered":"Tiempo"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html>\n&lt;html lang=\"es\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;title>Tiempo y Calidad del Aire&lt;\/title>\n&lt;\/head>\n&lt;body>\n    &lt;h1>Informaci\u00f3n Meteorol\u00f3gica&lt;\/h1>\n    &lt;p id=\"hora\">&lt;\/p>\n    &lt;p id=\"temperatura\">&lt;\/p>\n    &lt;p id=\"aire\">&lt;\/p>\n\n    &lt;script>\n        const apiKey = \"TU_API_KEY\"; \/\/ Reemplaza con tu clave real\n        const ciudad = \"Murcia\"; \/\/ Cambia por tu ubicaci\u00f3n\n\n        \/\/ Mostrar la hora actual\n        function actualizarHora() {\n            document.getElementById(\"hora\").innerText = \"Hora actual: \" + new Date().toLocaleTimeString();\n        }\n        setInterval(actualizarHora, 1000);\n\n        \/\/ Obtener datos de clima\n        async function obtenerClima() {\n            const url = `https:\/\/api.openweathermap.org\/data\/2.5\/weather?q=${ciudad}&amp;units=metric&amp;appid=${apiKey}`;\n            const respuesta = await fetch(url);\n            const datos = await respuesta.json();\n            document.getElementById(\"temperatura\").innerText = `Temperatura: ${datos.main.temp}\u00b0C`;\n        }\n\n        \/\/ Obtener calidad del aire\n        async function obtenerCalidadAire() {\n            const url = `https:\/\/api.openweathermap.org\/data\/2.5\/air_pollution?lat=37.98&amp;lon=-1.13&amp;appid=${apiKey}`;\n            const respuesta = await fetch(url);\n            const datos = await respuesta.json();\n            document.getElementById(\"aire\").innerText = `\u00cdndice de calidad del aire: ${datos.list&#91;0].main.aqi}`;\n        }\n\n        obtenerClima();\n        obtenerCalidadAire();\n    &lt;\/script>\n&lt;\/body>\n&lt;\/html>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-418","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/pages\/418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/comments?post=418"}],"version-history":[{"count":2,"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/pages\/418\/revisions"}],"predecessor-version":[{"id":420,"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/pages\/418\/revisions\/420"}],"wp:attachment":[{"href":"https:\/\/hdplayer.es\/index.php\/wp-json\/wp\/v2\/media?parent=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}