|
1 | | -import { ObjType } from '@/type'; |
2 | | -import { getHtml } from '@/utils/lib'; |
3 | | -import { MAX_DESC_LENGTH } from '@/utils/static'; |
4 | | -import * as cheerio from 'cheerio'; |
| 1 | +import { ObjType } from "@/type"; |
| 2 | +import { getHtml } from "@/utils/lib"; |
| 3 | +import { MAX_DESC_LENGTH } from "@/utils/static"; |
| 4 | +import * as cheerio from "cheerio"; |
5 | 5 |
|
6 | 6 | export const getYozmList = async () => { |
7 | | - const yozm = 'https://yozm.wishket.com'; |
| 7 | + const yozm = "https://yozm.wishket.com"; |
8 | 8 | const result: ObjType[] = []; |
9 | | - const html = await getHtml(yozm + '/magazine/list/develop'); |
| 9 | + const html = await getHtml(yozm + "/magazine/list/develop"); |
10 | 10 | const $ = cheerio.load(html?.data); |
11 | | - const $bodyList = $('div.list-cover ').children('div.list-item-link'); |
| 11 | + const $bodyList = $("div.list-cover ").children("div.list-item-link"); |
12 | 12 |
|
13 | 13 | $bodyList.each((i, elem) => { |
14 | 14 | result.push({ |
15 | | - title: $(elem).find('.list-item .item-main a.item-title').text(), |
16 | | - desc: $(elem).find('.list-item .item-description').text().slice(0, MAX_DESC_LENGTH) + '...', |
17 | | - url: yozm + $(elem).find('.list-item .item-main a.item-title').attr('href'), |
| 15 | + title: $(elem).find(".list-item .item-main a.item-title").text(), |
| 16 | + desc: |
| 17 | + $(elem) |
| 18 | + .find(".list-item .item-description") |
| 19 | + .text() |
| 20 | + .slice(0, MAX_DESC_LENGTH) + "...", |
| 21 | + url: |
| 22 | + yozm + $(elem).find(".list-item .item-main a.item-title").attr("href"), |
18 | 23 | }); |
19 | 24 | }); |
20 | 25 | return result; |
|
0 commit comments