From d3c9633365d6c2e1014e6b0b56adb4f9fc216fc9 Mon Sep 17 00:00:00 2001 From: harry-yoon Date: Tue, 30 May 2023 22:18:21 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20ts=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=ED=8F=AC=EB=A7=A4=ED=8C=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/yozm/index.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/yozm/index.ts b/src/yozm/index.ts index d70fa44..a195901 100644 --- a/src/yozm/index.ts +++ b/src/yozm/index.ts @@ -1,20 +1,25 @@ -import { ObjType } from '@/type'; -import { getHtml } from '@/utils/lib'; -import { MAX_DESC_LENGTH } from '@/utils/static'; -import * as cheerio from 'cheerio'; +import { ObjType } from "@/type"; +import { getHtml } from "@/utils/lib"; +import { MAX_DESC_LENGTH } from "@/utils/static"; +import * as cheerio from "cheerio"; export const getYozmList = async () => { - const yozm = 'https://yozm.wishket.com'; + const yozm = "https://yozm.wishket.com"; const result: ObjType[] = []; - const html = await getHtml(yozm + '/magazine/list/develop'); + const html = await getHtml(yozm + "/magazine/list/develop"); const $ = cheerio.load(html?.data); - const $bodyList = $('div.list-cover ').children('div.list-item-link'); + const $bodyList = $("div.list-cover ").children("div.list-item-link"); $bodyList.each((i, elem) => { result.push({ - title: $(elem).find('.list-item .item-main a.item-title').text(), - desc: $(elem).find('.list-item .item-description').text().slice(0, MAX_DESC_LENGTH) + '...', - url: yozm + $(elem).find('.list-item .item-main a.item-title').attr('href'), + title: $(elem).find(".list-item .item-main a.item-title").text(), + desc: + $(elem) + .find(".list-item .item-description") + .text() + .slice(0, MAX_DESC_LENGTH) + "...", + url: + yozm + $(elem).find(".list-item .item-main a.item-title").attr("href"), }); }); return result;