Browse Source

added El Siglo

Pablo 1 week ago
parent
commit
9704a58181
6 changed files with 34 additions and 1 deletions
  1. 2 0
      .env.example
  2. 1 1
      package.json
  3. 2 0
      src/config.ts
  4. 2 0
      src/index.ts
  5. 4 0
      src/portales/elsiglo/definition.yml
  6. 23 0
      src/portales/elsiglo/handler.ts

+ 2 - 0
.env.example

@@ -25,6 +25,7 @@ DF = "https://www.df.cl/ultimasnoticias"
 ELCIUDADANO = "https://www.elciudadano.com/"
 ELDESCONCIERTO = "https://eldesconcierto.cl"
 ELMOSTRADOR = "https://www.elmostrador.cl/categoria/dia/"
+ELSIGLO = "https://elsiglo.cl/"
 EMOL = "https://www.emol.com"
 FASTCHECK = "https://www.fastcheck.cl/"
 GLACIARESCHILENOS = "https://www.glaciareschilenos.org/articulos/"
@@ -49,6 +50,7 @@ MASTODON_KEY_DF = ""
 MASTODON_KEY_ELCIUDADANO = ""
 MASTODON_KEY_ELDESCONCIERTO = ""
 MASTODON_KEY_ELMOSTRADOR = ""
+MASTODON_KEY_ELSIGLO = ""
 MASTODON_KEY_EMOL = ""
 MASTODON_KEY_FASTCHECK = ""
 MASTODON_KEY_GLACIARESCHILENOS = ""

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "bot-noticias",
-  "version": "0.0.21",
+  "version": "0.0.23",
   "description": "Bot que busca noticias y las replica en mastodon.cl",
   "main": "dist/index.js",
   "scripts": {

+ 2 - 0
src/config.ts

@@ -27,6 +27,7 @@ const config = {
   ELCIUDADANO: process.env.ELCIUDADANO ?? "https://www.elciudadano.com/chile/",
   ELDESCONCIERTO: process.env.ELDESCONCIERTO ?? "https://eldesconcierto.cl",
   ELMOSTRADOR: process.env.ELMOSTRADOR ?? "https://www.elmostrador.cl/categoria/dia/",
+  ELSIGLO: process.env.ELSIGLO ?? "https://elsiglo.cl/",
   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/",
@@ -52,6 +53,7 @@ const config = {
   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_ELSIGLO: process.env.MASTODON_KEY_ELSIGLO ?? "",
   MASTODON_KEY_EMOL: process.env.MASTODON_KEY_EMOL ?? "",
   MASTODON_KEY_FASTCHECK: process.env.MASTODON_KEY_FASTCHECK ?? "",
   MASTODON_KEY_GLACIARESCHILENOS: process.env.MASTODON_KEY_GLACIARESCHILENOS ?? "",

+ 2 - 0
src/index.ts

@@ -14,6 +14,7 @@ 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 elsiglo } from "./portales/elsiglo/handler";
 import { handler as emol } from "./portales/emol/handler";
 import { handler as fastcheck } from "./portales/fastcheck/handler";
 // import { handler as glaciareschilenos } from "./portales/glaciareschilenos/handler";
@@ -55,6 +56,7 @@ const portalsHandlers = {
   "elciudadano": elciudadano,
   "eldesconcierto": eldesconcierto,
   "elmostrador": elmostrador,
+  "elsiglo": elsiglo,
   "emol": emol,
   "fastcheck": fastcheck,
   // "glaciareschilenos": glaciareschilenos,

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

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

+ 23 - 0
src/portales/elsiglo/handler.ts

@@ -0,0 +1,23 @@
+import { type Handler } from "aws-lambda";
+
+import config from "../../config";
+import Portal from "../portal";
+import ScraperMethods from "../../enums/scraper-methods";
+
+const name = "El Siglo";
+
+export const handler: Handler = new Portal(
+  name,
+  config.MASTODON_KEY_ELSIGLO,
+  {
+    url: config.ELSIGLO,
+    articlesSelector: ".post-item.post-block, .post-boxed",
+    titleSelector: ".entry-title a",
+    linkSelector: ".entry-title a",
+    contentSelector: ".entry-content p",
+    imageSelector: ".post-img",
+    scraperMethod: ScraperMethods.AXIOS,
+    maxArticles: 20,
+    hashtags: ["ElSiglo", "Noticias"]
+  }
+).getHandler();