Browse Source

added fast check source

Pablo Barrera Yaksic 3 tháng trước cách đây
mục cha
commit
18e755d03c
5 tập tin đã thay đổi với 31 bổ sung0 xóa
  1. 2 0
      .env.example
  2. 2 0
      src/config.ts
  3. 2 0
      src/index.ts
  4. 4 0
      src/portales/fastcheck/definition.yml
  5. 21 0
      src/portales/fastcheck/handler.ts

+ 2 - 0
.env.example

@@ -13,6 +13,7 @@ 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/"
 INTERFERENCIA = "https://interferencia.cl/"
 LATERCERA = "https://www.latercera.com/canal/nacional/"
 METRODESANTIAGO = ""
@@ -26,6 +27,7 @@ MASTODON_KEY_ELCIUDADANO = ""
 MASTODON_KEY_ELDESCONCIERTO = ""
 MASTODON_KEY_ELMOSTRADOR = ""
 MASTODON_KEY_EMOL = ""
+MASTODON_KEY_FASTCHECK = ""
 MASTODON_KEY_INTERFERENCIA = ""
 MASTODON_KEY_LATERCERA = ""
 MASTODON_KEY_METROSANTIAGO = ""

+ 2 - 0
src/config.ts

@@ -15,6 +15,7 @@ const config = {
   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/",
   INTERFERENCIA: process.env.INTERFERENCIA ?? "https://interferencia.cl/",
   LATERCERA: process.env.LATERCERA ?? "https://www.latercera.com/canal/nacional/",
   METRODESANTIAGO: process.env.METRODESANTIAGO ?? "https://xcancel.com/metrodesantiago",
@@ -27,6 +28,7 @@ const config = {
   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_INTERFERENCIA: process.env.MASTODON_KEY_INTERFERENCIA ?? "",
   MASTODON_KEY_LATERCERA: process.env.MASTODON_KEY_LATERCERA ?? "",
   MASTODON_KEY_METRODESANTIAGO: process.env.MASTODON_KEY_METRODESANTIAGO ?? "",

+ 2 - 0
src/index.ts

@@ -7,6 +7,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 fastcheck } from "./portales/fastcheck/handler";
 import { handler as emol } from "./portales/emol/handler";
 import { handler as interferencia } from "./portales/interferencia/handler";
 import { handler as latercera } from "./portales/latercera/handler";
@@ -35,6 +36,7 @@ const portalsHandlers = {
   "eldesconcierto": eldesconcierto,
   "elmostrador": elmostrador,
   "emol": emol,
+  "fastcheck": fastcheck,
   "interferencia": interferencia,
   "latercera": latercera,
   // "metrodesantiago": metrodesantiago,

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

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

+ 21 - 0
src/portales/fastcheck/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";
+import Emojis from "../../enums/emojis";
+
+const name = `Fast Check ${Emojis.MAGNIFYING_GLASS}`;
+
+export const handler: Handler = new Portal(
+  name, 
+  config.MASTODON_KEY_FASTCHECK,
+  {
+    url: config.FASTCHECK,
+    articlesSelector: "div.entries article",
+    titleSelector: "header h1",
+    linkSelector: "header h1 a",
+    scraperMethod: ScraperMethods.AXIOS,
+    hashtags: ["FastCheck", "Falso", "Incompleto", "Engañoso", "Real", "Noticias"]
+  }
+).getHandler();