diff --git a/.env.example b/.env.example index 9f0c1e7..83993fa 100644 --- a/.env.example +++ b/.env.example @@ -147,7 +147,7 @@ IPINFO_API_KEY="" # API can be queried without Token (but has lower rate limit) SPACEWEATHER_SOURCE="https://www.spaceweather.com/" NASA_API_KEY="DEMO_KEY" # API can be queried with the DEMO_KEY, but has rate limits NASA_APOD_API="https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}" -NASA_APOD_SOURCE="https://apod.nasa.gov/apod/" +NASA_APOD_SOURCE="https://science.nasa.gov/apod/" NASA_NEO_API="https://api.nasa.gov/neo/rest/v1/stats?api_key=${NASA_API_KEY}" NASA_DONKI_API_CME="https://api.nasa.gov/DONKI/CME?startDate=yyyy-MM-dd&endDate=yyyy-MM-dd&api_key=${NASA_API_KEY}" NASA_DONKI_API_CMEA="https://api.nasa.gov/DONKI/CMEAnalysis?startDate=2016-09-01&endDate=2016-09-30&mostAccurateOnly=true&speed=500&halfAngle=30&catalog=ALL&api_key=${NASA_API_KEY}" diff --git a/README.md b/README.md index fee311e..b7f4020 100644 --- a/README.md +++ b/README.md @@ -479,7 +479,7 @@ Die [NASA API](https://api.nasa.gov) wird benötigt um folgende Daten zu aggregi * Request: [https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY] * Result ``` -{"date":"2020-04-18","explanation":"It was just another day on aerosol Earth. For August 23, 2018, the identification and distribution of aerosols in the Earth's atmosphere is shown in this dramatic, planet-wide digital visualization. Produced in real time, the Goddard Earth Observing System Forward Processing (GEOS FP) model relies on a combination of Earth-observing satellite and ground-based data to calculate the presence of types of aerosols, tiny solid particles and liquid droplets, as they circulate above the entire planet. This August 23rd model shows black carbon particles in red from combustion processes, like smoke from the fires in the United States and Canada, spreading across large stretches of North America and Africa. Sea salt aerosols are in blue, swirling above threatening typhoons near South Korea and Japan, and the hurricane looming near Hawaii. Dust shown in purple hues is blowing over African and Asian deserts. The location of cities and towns can be found from the concentrations of lights based on satellite image data of the Earth at night. Celebrate: Earth Day at Home","hdurl":"https://apod.nasa.gov/apod/image/2004/atmosphere_geo5_2018235_eq2400.jpg","media_type":"image","service_version":"v1","title":"Just Another Day on Aerosol Earth","url":"https://apod.nasa.gov/apod/image/2004/atmosphere_geo5_2018235_eq1200.jpg"} +{"date":"2020-04-18","explanation":"It was just another day on aerosol Earth. For August 23, 2018, the identification and distribution of aerosols in the Earth's atmosphere is shown in this dramatic, planet-wide digital visualization. Produced in real time, the Goddard Earth Observing System Forward Processing (GEOS FP) model relies on a combination of Earth-observing satellite and ground-based data to calculate the presence of types of aerosols, tiny solid particles and liquid droplets, as they circulate above the entire planet. This August 23rd model shows black carbon particles in red from combustion processes, like smoke from the fires in the United States and Canada, spreading across large stretches of North America and Africa. Sea salt aerosols are in blue, swirling above threatening typhoons near South Korea and Japan, and the hurricane looming near Hawaii. Dust shown in purple hues is blowing over African and Asian deserts. The location of cities and towns can be found from the concentrations of lights based on satellite image data of the Earth at night. Celebrate: Earth Day at Home","hdurl":"https://science.nasa.gov/apod/image/2004/atmosphere_geo5_2018235_eq2400.jpg","media_type":"image","service_version":"v1","title":"Just Another Day on Aerosol Earth","url":"https://science.nasa.gov/apod/image/2004/atmosphere_geo5_2018235_eq1200.jpg"} ``` ## Telegram Bot API diff --git a/public/includes/apod.inc.php b/public/includes/apod.inc.php index defa477..8da8c46 100644 --- a/public/includes/apod.inc.php +++ b/public/includes/apod.inc.php @@ -74,11 +74,11 @@ function get_apod($apod_date_input=NULL) * [copyright] => Francesco Sferlazza * [date] => 2018-08-01 * [explanation] => Cosmic rays from outer space go through your body every second. Typically, they do you no harm [...] - * [hdurl] => https://apod.nasa.gov/apod/http://nusoft.fnal.gov/nova/public/img/FD-evt-echo.gif + * [hdurl] => https://science.nasa.gov/apod/http://nusoft.fnal.gov/nova/public/img/FD-evt-echo.gif * [media_type] => image * [service_version] => v1 * [title] => Live: Cosmic Rays from Minnesota - * [url] => https://apod.nasa.gov/apod/http://nusoft.fnal.gov/nova/public/img/FD-evt-echo.gif + * [url] => https://science.nasa.gov/apod/http://nusoft.fnal.gov/nova/public/img/FD-evt-echo.gif * ) */ zorgDebugger::log()->debug('date("ymd",$apod_date_input): %s', [date('ymd',strtotime($apod_date_input))]); @@ -89,9 +89,10 @@ function get_apod($apod_date_input=NULL) $new_apod_explanation = (isset($apod_data['explanation']) ? $apod_data['explanation'] : 'The best APODs have no words at all - the image says it all.'); $new_apod_copyright = (isset($apod_data['copyright']) ? $apod_data['copyright'] : 'Uncredited'); $new_apod_mediatype = (isset($apod_data['media_type']) ? $apod_data['media_type'] : ''); - $new_apod_img_small = str_replace('https://apod.nasa.gov/apod/http', 'http', $apod_data['url']); // with fix for malformed url (APOD API issue) - $new_apod_img_large = str_replace('https://apod.nasa.gov/apod/http', 'http', $apod_data['hdurl']); // with fix for malformed url (APOD API issue) - $new_apod_archive_url = APOD_SOURCE . 'ap'.$new_apod_date.'.html'; // E.g.: https://apod.nasa.gov/apod/ap180714.html + $apod_source_http_prefix = APOD_SOURCE . 'http'; + $new_apod_img_small = str_replace(['https://apod.nasa.gov/apod/http', $apod_source_http_prefix], 'http', $apod_data['url']); // with fix for malformed url (APOD API issue) + $new_apod_img_large = str_replace(['https://apod.nasa.gov/apod/http', $apod_source_http_prefix], 'http', $apod_data['hdurl']); // with fix for malformed url (APOD API issue) + $new_apod_archive_url = APOD_SOURCE . 'ap'.$new_apod_date.'.html'; // E.g.: https://science.nasa.gov/apod/ap180714.html $new_apod_urlparts = pathinfo($new_apod_img_small); zorgDebugger::log()->debug('pathinfo(): %s', [print_r($new_apod_urlparts,true)]); $new_apod_fileext = $new_apod_urlparts['extension'];