소스 검색

Merge branch 'develop' of Mastodon/bots into main

Pablo Yaksic 2 주 전
부모
커밋
adc234a0d6
6개의 변경된 파일35개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      .env.example
  2. 1 0
      serverless.yml
  3. 2 0
      src/config.ts
  4. 2 0
      src/index.ts
  5. 4 0
      src/portales/resumen/definition.yml
  6. 24 0
      src/portales/resumen/handler.ts

+ 2 - 0
.env.example

@@ -30,6 +30,7 @@ GLACIARESCHILENOS = "https://www.glaciareschilenos.org/articulos/"
 INTERFERENCIA = "https://interferencia.cl/"
 LADERASUR = "https://laderasur.com/articulos-2/"
 LATERCERA = "https://www.latercera.com/canal/nacional/"
+RESUMEN = "https://resumen.cl/"
 SISMOLOGIA = "https://www.sismologia.cl/index.html"
 TARREO = "https://www.tarreo.com/noticias/"
 THECLINIC = "https://www.theclinic.cl/lo-ultimo/"
@@ -51,6 +52,7 @@ MASTODON_KEY_GLACIARESCHILENOS = ""
 MASTODON_KEY_INTERFERENCIA = ""
 MASTODON_KEY_LADERASUR = ""
 MASTODON_KEY_LATERCERA = ""
+MASTODON_KEY_RESUMEN = ""
 MASTODON_KEY_SISMOLOGIA = ""
 MASTODON_KEY_TARREO = ""
 MASTODON_KEY_THECLINIC = ""

+ 1 - 0
serverless.yml

@@ -21,5 +21,6 @@ functions:
   - ${file(./src/portales/emol/definition.yml)}
   - ${file(./src/portales/latercera/definition.yml)}
   - ${file(./src/portales/adnradio/definition.yml)}
+  - ${file(./src/portales/resumen/definition.yml)}
   - ${file(./src/portales/theclinic/definition.yml)}
   - ${file(./src/agents/countdown/definition.yml)}

+ 2 - 0
src/config.ts

@@ -32,6 +32,7 @@ const config = {
   INTERFERENCIA: process.env.INTERFERENCIA ?? "https://interferencia.cl/",
   LADERASUR: process.env.LADERASUR ?? "https://laderasur.com/",
   LATERCERA: process.env.LATERCERA ?? "https://www.latercera.com/canal/nacional/",
+  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/",
   THECLINIC: process.env.THECLINIC ?? "https://www.theclinic.cl/lo-ultimo/",
@@ -53,6 +54,7 @@ const config = {
   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_RESUMEN: process.env.MASTODON_KEY_RESUMEN ?? "",
   MASTODON_KEY_SISMOLOGIA: process.env.MASTODON_KEY_SISMOLOGIA ?? "",
   MASTODON_KEY_TARREO: process.env.MASTODON_KEY_TARREO ?? "",
   MASTODON_KEY_THECLINIC: process.env.MASTODON_KEY_THECLINIC ?? "",

+ 2 - 0
src/index.ts

@@ -20,6 +20,7 @@ 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 resumen } from "./portales/resumen/handler";
 import { handler as tarreo } from "./portales/tarreo/handler";
 import { handler as theclinic } from "./portales/theclinic/handler";
 
@@ -56,6 +57,7 @@ const portalsHandlers = {
   "interferencia": interferencia,
   "laderasur": laderasur,
   "latercera": latercera,
+  "resumen": resumen,
   "tarreo": tarreo,
   "theclinic": theclinic
 };

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

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

+ 24 - 0
src/portales/resumen/handler.ts

@@ -0,0 +1,24 @@
+import { type Handler } from "aws-lambda";
+
+import config from "../../config";
+import Portal from "../portal";
+import ScraperMethods from "../../enums/scraper-methods";
+
+const name = "Resumen.cl";
+
+export const handler: Handler = new Portal(
+  name,
+  config.MASTODON_KEY_RESUMEN,
+  {
+    url: config.RESUMEN,
+    articlesSelector: ".rsmn-destacados__primaria, .rsmn-destacados__secundaria, .rsmn-main__secciones--destacados .rsmn-home__seccion-destacada",
+    titleSelector: "a h1, a h3",
+    linkSelector: "a",
+    imageSelector: "picture img",
+    linkPrefix: "https://resumen.cl",
+    scraperMethod: ScraperMethods.AXIOS,
+    cacheExpiration: 60 * 60 * 24 * 5, // 5 días
+    maxArticles: 20,
+    hashtags: ["Resumen", "Chile", "Noticias"]
+  }
+).getHandler();