Browse Source

added tarreo

Pablo Barrera Yaksic 2 months ago
parent
commit
100b1a7bc9
5 changed files with 33 additions and 1 deletions
  1. 3 1
      .env.example
  2. 2 0
      src/config.ts
  3. 2 0
      src/index.ts
  4. 4 0
      src/portales/tarreo/definition.yml
  5. 22 0
      src/portales/tarreo/handler.ts

+ 3 - 1
.env.example

@@ -17,8 +17,9 @@ EMOL = "https://www.emol.com"
 FASTCHECK = "https://www.fastcheck.cl/category/chequeo/"
 INTERFERENCIA = "https://interferencia.cl/"
 LATERCERA = "https://www.latercera.com/canal/nacional/"
-METRODESANTIAGO = ""
+METRODESANTIAGO = "https://xcancel.com/metrodesantiago"
 SISMOLOGIA = "https://www.sismologia.cl/index.html"
+TARREO = "https://www.tarreo.com/noticias/"
 THECLINIC = "https://www.theclinic.cl/lo-ultimo/"
 
 # KEYS
@@ -34,6 +35,7 @@ MASTODON_KEY_INTERFERENCIA = ""
 MASTODON_KEY_LATERCERA = ""
 MASTODON_KEY_METROSANTIAGO = ""
 MASTODON_KEY_SISMOLOGIA = ""
+MASTODON_KEY_TARREO
 MASTODON_KEY_THECLINIC = ""
 
 ## AGENTS

+ 2 - 0
src/config.ts

@@ -21,6 +21,7 @@ const config = {
   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",
+  TARREO: process.env.TARREO ?? "https://www.tarreo.com/noticias/",
   THECLINIC: process.env.THECLINIC ?? "https://www.theclinic.cl/lo-ultimo/",
   // KEYS
   MASTODON_KEY_CHILECULTURA: process.env.MASTODON_KEY_CHILECULTURA ?? "",
@@ -35,6 +36,7 @@ const config = {
   MASTODON_KEY_LATERCERA: process.env.MASTODON_KEY_LATERCERA ?? "",
   MASTODON_KEY_METRODESANTIAGO: process.env.MASTODON_KEY_METRODESANTIAGO ?? "",
   MASTODON_KEY_SISMOLOGIA: process.env.MASTODON_KEY_SISMOLOGIA ?? "",
+  MASTODON_KEY_TARREO: process.env.MASTODON_KEY_TARREO ?? "",
   MASTODON_KEY_THECLINIC: process.env.MASTODON_KEY_THECLINIC ?? "",
   // AGENTS
   MASTODON_KEY_FORTUNE: process.env.MASTODON_KEY_FORTUNE ?? "",

+ 2 - 0
src/index.ts

@@ -13,6 +13,7 @@ import { handler as emol } from "./portales/emol/handler";
 import { handler as interferencia } from "./portales/interferencia/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";
 import { handler as theclinic } from "./portales/theclinic/handler";
 
 const context: Context = {
@@ -42,6 +43,7 @@ const portalsHandlers = {
   "interferencia": interferencia,
   "latercera": latercera,
   // "metrodesantiago": metrodesantiago,
+  "tarreo": tarreo,
   "theclinic": theclinic,
 };
 

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

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

+ 22 - 0
src/portales/tarreo/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 = `Tarreo`;
+
+export const handler: Handler = new Portal(
+  name, 
+  config.MASTODON_KEY_TARREO,
+  {
+    url: config.TARREO,
+    articlesSelector: "section.lists_list_main ul.news li article",
+    titleSelector: "h4.elementHeader a",
+    linkSelector: "h4.elementHeader a",
+    scraperMethod: ScraperMethods.AXIOS,
+    hashtags: ["Tarreo", "VideoJuegos", "Noticias"],
+    linkPrefix: "https://www.tarreo.com",
+    cacheExpiration: 60 * 60 * 24 * 5, // 5 días
+  }
+).getHandler();