Explorar el Código

Merge branch 'develop' of Mastodon/bots into main

Pablo Yaksic hace 1 semana
padre
commit
8f2c35ae9c
Se han modificado 5 ficheros con 32 adiciones y 0 borrados
  1. 2 0
      .env.example
  2. 2 0
      src/config.ts
  3. 2 0
      src/index.ts
  4. 4 0
      src/portales/meteored/definition.yml
  5. 22 0
      src/portales/meteored/handler.ts

+ 2 - 0
.env.example

@@ -31,6 +31,7 @@ GLACIARESCHILENOS = "https://www.glaciareschilenos.org/articulos/"
 INTERFERENCIA = "https://interferencia.cl/"
 LADERASUR = "https://laderasur.com/articulos-2/"
 LATERCERA = "https://www.latercera.com/canal/nacional/"
+METEORED = "https://www.meteored.cl/"
 RESUMEN = "https://resumen.cl/"
 SISMOLOGIA = "https://www.sismologia.cl/index.html"
 TARREO = "https://www.tarreo.com/noticias/"
@@ -55,6 +56,7 @@ MASTODON_KEY_INTERFERENCIA = ""
 MASTODON_KEY_LADERASUR = ""
 MASTODON_KEY_LANACION = ""
 MASTODON_KEY_LATERCERA = ""
+MASTODON_KEY_METEORED = ""
 MASTODON_KEY_RESUMEN = ""
 MASTODON_KEY_SISMOLOGIA = ""
 MASTODON_KEY_TARREO = ""

+ 2 - 0
src/config.ts

@@ -34,6 +34,7 @@ const config = {
   LADERASUR: process.env.LADERASUR ?? "https://laderasur.com/",
   LANACION: process.env.LANACION ?? "https://www.lanacion.cl/",
   LATERCERA: process.env.LATERCERA ?? "https://www.latercera.com/canal/nacional/",
+  METEORED: process.env.METEORED ?? "https://www.meteored.cl/",
   RESUMEN: process.env.RESUMEN ?? "https://resumen.cl/",
   SISMOLOGIA: process.env.SISMOLOGIA ?? "https://www.sismologia.cl/index.html",
   TARREO: process.env.TARREO ?? "https://www.tarreo.com/noticias/",
@@ -58,6 +59,7 @@ const config = {
   MASTODON_KEY_LADERASUR: process.env.MASTODON_KEY_LADERASUR ?? "",
   MASTODON_KEY_LANACION: process.env.MASTODON_KEY_LANACION ?? "",
   MASTODON_KEY_LATERCERA: process.env.MASTODON_KEY_LATERCERA ?? "",
+  MASTODON_KEY_METEORED: process.env.MASTODON_KEY_METEORED ?? "",
   MASTODON_KEY_RESUMEN: process.env.MASTODON_KEY_RESUMEN ?? "",
   MASTODON_KEY_SISMOLOGIA: process.env.MASTODON_KEY_SISMOLOGIA ?? "",
   MASTODON_KEY_TARREO: process.env.MASTODON_KEY_TARREO ?? "",

+ 2 - 0
src/index.ts

@@ -21,6 +21,7 @@ import { handler as interferencia } from "./portales/interferencia/handler";
 import { handler as laderasur } from "./portales/laderasur/handler";
 import { handler as lanacion } from "./portales/lanacion/handler";
 import { handler as latercera } from "./portales/latercera/handler";
+import { handler as meteored } from "./portales/meteored/handler";
 // import { handler as metrodesantiago } from "./portales/metrodesantiago/handler";
 import { handler as resumen } from "./portales/resumen/handler";
 import { handler as tarreo } from "./portales/tarreo/handler";
@@ -61,6 +62,7 @@ const portalsHandlers = {
   "laderasur": laderasur,
   "lanacion": lanacion,
   "latercera": latercera,
+  "meteored": meteored,
   //"resumen": resumen,
   "tarreo": tarreo,
   "theclinic": theclinic

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

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

+ 22 - 0
src/portales/meteored/handler.ts

@@ -0,0 +1,22 @@
+import { type Handler } from "aws-lambda";
+
+import config from "../../config";
+import Portal from "../portal";
+import ScraperMethods from "../../enums/scraper-methods";
+
+const name = "Meteored";
+
+export const handler: Handler = new Portal(
+  name,
+  config.MASTODON_KEY_METEORED,
+  {
+    url: config.METEORED,
+    articlesSelector: "article.articles-row, article.destacado-l, article.item-principal",
+    titleSelector: "h2 a",
+    linkSelector: "h2 a",
+    imageSelector: "img.foto-s, img.foto-m",
+    scraperMethod: ScraperMethods.AXIOS,
+    maxArticles: 20,
+    hashtags: ["Meteored", "Clima", "Chile"]
+  }
+).getHandler();