Toutes les sources
Earthquake Alerts
Actualités v1.0.0Recent significant earthquakes worldwide from USGS
@codytseng #earthquake #alerts #science
Configuration
| Nom | Clé | Type | Requis | Défaut | Description |
|---|---|---|---|---|---|
| Min Magnitude | MIN_MAGNITUDE | select | Non | 4.5 | Minimum earthquake magnitude to display significant4.52.51.0all |
| Time Range | TIME_RANGE | select | Non | day | Time range for earthquake data hourdayweekmonth |
Code source
version: 1.0.0
name: Earthquake Alerts
description: Recent significant earthquakes worldwide from USGS
author: codytseng
author_url: https://github.com/codytseng
category: News
tags:
- earthquake
- alerts
- science
config:
- key: MIN_MAGNITUDE
name: Min Magnitude
type: select
required: false
default: "4.5"
description: Minimum earthquake magnitude to display
options:
- significant
- "4.5"
- "2.5"
- "1.0"
- all
- key: TIME_RANGE
name: Time Range
type: select
required: false
default: day
description: Time range for earthquake data
options:
- hour
- day
- week
- month version: 1.0.0
name: Earthquake Alerts
description: Recent significant earthquakes worldwide from USGS
author: codytseng
author_url: https://github.com/codytseng
category: News
tags:
- earthquake
- alerts
- science
config:
- key: MIN_MAGNITUDE
name: Min Magnitude
type: select
required: false
default: "4.5"
description: Minimum earthquake magnitude to display
options:
- significant
- "4.5"
- "2.5"
- "1.0"
- all
- key: TIME_RANGE
name: Time Range
type: select
required: false
default: day
description: Time range for earthquake data
options:
- hour
- day
- week
- month module.exports = async (api) => {
const minMagnitude = api.config.get("MIN_MAGNITUDE") || "4.5";
const timeRange = api.config.get("TIME_RANGE") || "day";
async function fetchData() {
const res = await api.fetch(
`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/${minMagnitude}_${timeRange}.geojson`,
);
if (!res.ok || !res.json) {
throw new Error(`Failed to fetch earthquake data (HTTP ${res.status})`);
}
const items = res.json.features.map((feature) => ({
id: feature.id,
title: feature.properties.title,
subtitle: feature.properties.place,
url: feature.properties.url,
timestamp: feature.properties.time,
}));
api.emit(items);
}
await fetchData();
return {
refresh: fetchData,
};
}; module.exports = async (api) => {
const minMagnitude = api.config.get("MIN_MAGNITUDE") || "4.5";
const timeRange = api.config.get("TIME_RANGE") || "day";
async function fetchData() {
const res = await api.fetch(
`https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/${minMagnitude}_${timeRange}.geojson`,
);
if (!res.ok || !res.json) {
throw new Error(`Failed to fetch earthquake data (HTTP ${res.status})`);
}
const items = res.json.features.map((feature) => ({
id: feature.id,
title: feature.properties.title,
subtitle: feature.properties.place,
url: feature.properties.url,
timestamp: feature.properties.time,
}));
api.emit(items);
}
await fetchData();
return {
refresh: fetchData,
};
};