소스 검색

updated chilecultura and emol to use puppeteer

Pablo Barrera Yaksic 1 일 전
부모
커밋
cb4cdb7a9d

+ 2 - 2
src/index.ts

@@ -5,7 +5,7 @@ import config from "./config";
 import { handler as chilecultura } from "./portales/chilecultura/handler";
 import { handler as ciper } from "./portales/ciper/handler";
 import { handler as codexverde } from "./portales/codexverde/handler";
-import { handler as cooperativa } from "./portales/cooperativa/handler";
+// import { handler as cooperativa } from "./portales/cooperativa/handler";
 import { handler as df } from "./portales/df/handler";
 import { handler as elciudadano } from "./portales/elciudadano/handler";
 import { handler as eldesconcierto } from "./portales/eldesconcierto/handler";
@@ -39,7 +39,7 @@ const portalsHandlers = {
   "chilecultura": chilecultura,
   "ciper": ciper,
   "codexverde": codexverde,
-  "cooperativa": cooperativa,
+  // "cooperativa": cooperativa,
   "df": df,
   "elciudadano": elciudadano,
   "eldesconcierto": eldesconcierto,

+ 1 - 1
src/portales/chilecultura/handler.ts

@@ -18,7 +18,7 @@ export const handler: Handler = new Portal(
     imagePrefix: "https://chilecultura.gob.cl",
     contentSelector: "",
     linkPrefix: "https://chilecultura.gob.cl",
-    scraperMethod: ScraperMethods.AXIOS,
+    scraperMethod: ScraperMethods.PUPPETEER,
     cacheExpiration: 60 * 60 * 24 * 7, // 7 días
     hashtags: ["ChileCultura", "Cartelera", "Panoramas", "Cultura", "Chile"]
   }

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

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

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

@@ -1,23 +0,0 @@
-import { type Handler } from "aws-lambda";
-
-import config from "../../config";
-import Portal from "../portal";
-import ScraperMethods from "../../enums/scraper-methods";
-
-const name = `Cooperativa`;
-const today = new Date().toISOString().slice(0, 10).replace(/-/g, '');
-
-export const handler: Handler = new Portal(
-  name, 
-  config.MASTODON_KET_COOPERATIVA,
-  {
-    url: config.COOPERATIVA + today + '.html',
-    articlesSelector: "article.art-todas",
-    titleSelector: "div.contenedor-datos div.fecha-publicacion a",
-    linkSelector: "div.contenedor-datos div.fecha-publicacion a",
-    scraperMethod: ScraperMethods.AXIOS,
-    hashtags: ["Cooperativa", "Noticias"],
-    cacheExpiration: 60 * 60 * 24 * 30, // 30 días
-    linkPrefix: "https://cooperativa.cl"
-  }
-).getHandler();

+ 1 - 1
src/portales/emol/handler.ts

@@ -15,7 +15,7 @@ export const handler: Handler = new Portal(
     titleSelector: "h1 a, h3 a",
     linkSelector: "h1 a, h3 a",
     linkPrefix: config.EMOL,
-    scraperMethod: ScraperMethods.AXIOS,
+    scraperMethod: ScraperMethods.PUPPETEER,
     hashtags: ["Emol", "ElMercurioOnline", "ElMercurio", "Noticias"]
   }
 ).getHandler();

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

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

+ 0 - 20
src/portales/metrodesantiago/handler.ts

@@ -1,20 +0,0 @@
-import { type Handler } from "aws-lambda";
-
-import config from "../../config";
-import Portal from "../portal";
-import ScraperMethods from "../../enums/scraper-methods";
-
-const name = "Metro de Santiago";
-
-export const handler: Handler = new Portal(
-  name, 
-  config.MASTODON_KEY_METRODESANTIAGO,
-  {
-    url: config.METRODESANTIAGO,
-    linkPrefix: config.METRODESANTIAGO,
-    articlesSelector: "div.timeline div.timeline-item",
-    titleSelector: "div.tweet-body div.tweet-header div.tweet-name-row div.fullname-and-username a.fullname",
-    linkSelector: "a.tweet-link",
-    scraperMethod: ScraperMethods.PUPPETEER
-  }
-).getHandler();

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

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

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

@@ -1,23 +0,0 @@
-import { type Handler } from "aws-lambda";
-
-import config from "../../config";
-import Portal from "../portal";
-import ScraperMethods from "../../enums/scraper-methods";
-
-const name = `Cooperativa`;
-const today = new Date().toISOString().slice(0, 10).replace(/-/g, '');
-
-export const handler: Handler = new Portal(
-  name, 
-  config.MASTODON_KET_COOPERATIVA,
-  {
-    url: config.COOPERATIVA + today + '.html',
-    articlesSelector: "article.art-todas",
-    titleSelector: "div.contenedor-datos div.fecha-publicacion a",
-    linkSelector: "div.contenedor-datos div.fecha-publicacion a",
-    scraperMethod: ScraperMethods.AXIOS,
-    hashtags: ["Cooperativa", "Noticias"],
-    cacheExpiration: 60 * 60 * 24 * 30, // 30 días
-    linkPrefix: "https://cooperativa.cl"
-  }
-).getHandler();