Quellcode durchsuchen

added codexverde, laderasur and glaciareschilenos

Pablo Barrera Yaksic vor 2 Monaten
Ursprung
Commit
89d36cfc1b

+ 6 - 0
.env.example

@@ -9,13 +9,16 @@ IMG_PLACEHOLDER = "https://placehold.co/600x400"
 
 CHILECULTURA = "https://chilecultura.gob.cl/events/"
 CIPER = "https://www.ciperchile.cl/actualidad/"
+CODEXVERDE = "https://codexverde.cl/"
 DF = "https://www.df.cl/ultimasnoticias"
 ELCIUDADANO = "https://www.elciudadano.com/"
 ELDESCONCIERTO = "https://eldesconcierto.cl"
 ELMOSTRADOR = "https://www.elmostrador.cl/categoria/dia/"
 EMOL = "https://www.emol.com"
 FASTCHECK = "https://www.fastcheck.cl/category/chequeo/"
+GLACIARESCHILENOS = "https://www.glaciareschilenos.org/articulos/"
 INTERFERENCIA = "https://interferencia.cl/"
+LADERASUR = "https://laderasur.com/articulos-2/"
 LATERCERA = "https://www.latercera.com/canal/nacional/"
 METRODESANTIAGO = "https://xcancel.com/metrodesantiago"
 SISMOLOGIA = "https://www.sismologia.cl/index.html"
@@ -25,13 +28,16 @@ THECLINIC = "https://www.theclinic.cl/lo-ultimo/"
 # KEYS
 MASTODON_KEY_CHILECULTURA = ""
 MASTODON_KEY_CIPER = ""
+MASTODON_KEY_CODEXVERDE = ""
 MASTODON_KEY_DF = ""
 MASTODON_KEY_ELCIUDADANO = ""
 MASTODON_KEY_ELDESCONCIERTO = ""
 MASTODON_KEY_ELMOSTRADOR = ""
 MASTODON_KEY_EMOL = ""
 MASTODON_KEY_FASTCHECK = ""
+MASTODON_KEY_GLACIARESCHILENOS = ""
 MASTODON_KEY_INTERFERENCIA = ""
+MASTODON_KEY_LADERASUR = ""
 MASTODON_KEY_LATERCERA = ""
 MASTODON_KEY_METROSANTIAGO = ""
 MASTODON_KEY_SISMOLOGIA = ""

+ 7 - 1
src/config.ts

@@ -11,13 +11,16 @@ const config = {
   // PORTALES
   CHILECULTURA: process.env.CHILECULTURA ?? "https://chilecultura.gob.cl/events/",
   CIPER: process.env.CIPER ?? "https://www.ciperchile.cl/actualidad/",
+  CODEXVERDE: process.env.CODEXVERDE ?? "https://codexverde.cl/",
   DF: process.env.DF ?? "https://www.df.cl/ultimasnoticias",
   ELCIUDADANO: process.env.ELCIUDADANO ?? "https://www.elciudadano.com/",
   ELDESCONCIERTO: process.env.ELDESCONCIERTO ?? "https://eldesconcierto.cl",
   ELMOSTRADOR: process.env.ELMOSTRADOR ?? "https://www.elmostrador.cl/categoria/dia/",
   EMOL: process.env.EMOL ?? "https://www.emol.com",
   FASTCHECK: process.env.FASTCHECK ?? "https://www.fastcheck.cl/category/chequeo/",
+  GLACIARESCHILENOS: process.env.GLACIARESCHILENOS ?? "https://www.glaciareschilenos.org/articulos/",
   INTERFERENCIA: process.env.INTERFERENCIA ?? "https://interferencia.cl/",
+  LADERASUR: process.env.LADERASUR ?? "https://laderasur.com/",
   LATERCERA: process.env.LATERCERA ?? "https://www.latercera.com/canal/nacional/",
   METRODESANTIAGO: process.env.METRODESANTIAGO ?? "https://xcancel.com/metrodesantiago",
   SISMOLOGIA: process.env.SISMOLOGIA ?? "https://www.sismologia.cl/index.html",
@@ -25,14 +28,17 @@ const config = {
   THECLINIC: process.env.THECLINIC ?? "https://www.theclinic.cl/lo-ultimo/",
   // KEYS
   MASTODON_KEY_CHILECULTURA: process.env.MASTODON_KEY_CHILECULTURA ?? "",
-  MASTODON_KEY_CIPER: process.env.MASTODON_KEY_CIPER?? "",
+  MASTODON_KEY_CIPER: process.env.MASTODON_KEY_CIPER ?? "",
+  MASTODON_KEY_CODEXVERDE: process.env.MASTODON_KEY_CODEXVERDE ?? "",
   MASTODON_KEY_DF: process.env.MASTODON_KEY_DF ?? "",
   MASTODON_KEY_ELCIUDADANO: process.env.MASTODON_KEY_ELCIUDADANO ?? "",
   MASTODON_KEY_ELDESCONCIERTO: process.env.MASTODON_KEY_ELDESCONCIERTO ?? "",
   MASTODON_KEY_ELMOSTRADOR: process.env.MASTODON_KEY_ELMOSTRADOR ?? "",
   MASTODON_KEY_EMOL: process.env.MASTODON_KEY_EMOL ?? "",
   MASTODON_KEY_FASTCHECK: process.env.MASTODON_KEY_FASTCHECK ?? "",
+  MASTODON_KEY_GLACIARESCHILENOS: process.env.MASTODON_KEY_GLACIARESCHILENOS ?? "",
   MASTODON_KEY_INTERFERENCIA: process.env.MASTODON_KEY_INTERFERENCIA ?? "",
+  MASTODON_KEY_LADERASUR: process.env.MASTODON_KEY_LADERASUR ?? "",
   MASTODON_KEY_LATERCERA: process.env.MASTODON_KEY_LATERCERA ?? "",
   MASTODON_KEY_METRODESANTIAGO: process.env.MASTODON_KEY_METRODESANTIAGO ?? "",
   MASTODON_KEY_SISMOLOGIA: process.env.MASTODON_KEY_SISMOLOGIA ?? "",

+ 6 - 0
src/index.ts

@@ -4,13 +4,16 @@ import config from "./config";
 
 import { handler as chilecultura } from "./portales/chilecultura/handler";
 import { handler as ciper } from "./portales/ciper/handler";
+import { handler as codexverde } from "./portales/codexverde/handler";
 import { handler as df } from "./portales/df/handler";
 import { handler as elciudadano } from "./portales/elciudadano/handler";
 import { handler as eldesconcierto } from "./portales/eldesconcierto/handler";
 import { handler as elmostrador } from "./portales/elmostrador/handler";
 import { handler as fastcheck } from "./portales/fastcheck/handler";
+import { handler as glaciareschilenos } from "./portales/glaciareschilenos/handler";
 import { handler as emol } from "./portales/emol/handler";
 import { handler as interferencia } from "./portales/interferencia/handler";
+import { handler as laderasur } from "./portales/laderasur/handler";
 import { handler as latercera } from "./portales/latercera/handler";
 // import { handler as metrodesantiago } from "./portales/metrodesantiago/handler";
 import { handler as tarreo } from "./portales/tarreo/handler";
@@ -34,13 +37,16 @@ const context: Context = {
 const portalsHandlers = {
   "chilecultura": chilecultura,
   "ciper": ciper,
+  "codexverde": codexverde,
   "df": df,
   "elciudadano": elciudadano,
   "eldesconcierto": eldesconcierto,
   "elmostrador": elmostrador,
   "emol": emol,
   "fastcheck": fastcheck,
+  "glaciareschilenos": glaciareschilenos,
   "interferencia": interferencia,
+  "laderasur": laderasur,
   "latercera": latercera,
   // "metrodesantiago": metrodesantiago,
   "tarreo": tarreo,

+ 4 - 0
src/portales/codexverde/definition.yml

@@ -0,0 +1,4 @@
+emol:
+  handler: ./src/portales/codexverde/handler.handler
+  events: 
+    - schedule: rate(1 hour)

+ 21 - 0
src/portales/codexverde/handler.ts

@@ -0,0 +1,21 @@
+import { type Handler } from "aws-lambda";
+
+import config from "../../config";
+import Portal from "../portal";
+import ScraperMethods from "../../enums/scraper-methods";
+
+const name = `Codexverde`;
+
+export const handler: Handler = new Portal(
+  name, 
+  config.MASTODON_KEY_CODEXVERDE,
+  {
+    url: config.CODEXVERDE,
+    articlesSelector: "#tdi_110 > div:nth-child(1) > div:nth-child(1), #tdi_111 div.td-cpt-post",
+    titleSelector: "div.td-module-meta-info h3",
+    linkSelector: "div.td-module-meta-info h3 a",
+    scraperMethod: ScraperMethods.AXIOS,
+    hashtags: ["Codexverde", "Gestionambiental", "Agua", "Aire", "Biodiversidad", "Cambioclimatico", "Energia", "Residuos"],
+    cacheExpiration: 60 * 60 * 24 * 30, // 30 días
+  }
+).getHandler();

+ 4 - 0
src/portales/glaciareschilenos/definition.yml

@@ -0,0 +1,4 @@
+emol:
+  handler: ./src/portales/glaciareschilenos/handler.handler
+  events: 
+    - schedule: rate(1 hour)

+ 21 - 0
src/portales/glaciareschilenos/handler.ts

@@ -0,0 +1,21 @@
+import { type Handler } from "aws-lambda";
+
+import config from "../../config";
+import Portal from "../portal";
+import ScraperMethods from "../../enums/scraper-methods";
+
+const name = `Fundación Glaciares Chilenos`;
+
+export const handler: Handler = new Portal(
+  name, 
+  config.MASTODON_KEY_GLACIARESCHILENOS,
+  {
+    url: config.GLACIARESCHILENOS,
+    articlesSelector: "article",
+    titleSelector: "h2.entry-title",
+    linkSelector: "h2.entry-title a",
+    scraperMethod: ScraperMethods.AXIOS,
+    hashtags: ["Fundacion", "GlaciaresChilenos", "Glaciares", "Chile", "MedioAmbiente", "Artículos"],
+    cacheExpiration: 60 * 60 * 24 * 30, // 30 días
+  }
+).getHandler();

+ 4 - 0
src/portales/laderasur/definition.yml

@@ -0,0 +1,4 @@
+emol:
+  handler: ./src/portales/laderasur/handler.handler
+  events: 
+    - schedule: rate(1 hour)

+ 21 - 0
src/portales/laderasur/handler.ts

@@ -0,0 +1,21 @@
+import { type Handler } from "aws-lambda";
+
+import config from "../../config";
+import Portal from "../portal";
+import ScraperMethods from "../../enums/scraper-methods";
+
+const name = `Ladera Sur`;
+
+export const handler: Handler = new Portal(
+  name, 
+  config.MASTODON_KEY_LADERASUR,
+  {
+    url: config.LADERASUR,
+    articlesSelector: "ul.featured-articles-list li, ul.articles-list li",
+    titleSelector: "a h3, a h2",
+    linkSelector: "a",
+    scraperMethod: ScraperMethods.AXIOS,
+    hashtags: ["LaderaSur", "Ciencia", "Biodiversidad", "ViajesYDestinos", "MedioAmbiente", "DeporteYOutdoor", "Arte", "Cultura", "Patrimonio"],
+    cacheExpiration: 60 * 60 * 24 * 30, // 30 días
+  }
+).getHandler();