From 504bdb77bdbfe9859c378557da71b2b943d53b5b Mon Sep 17 00:00:00 2001 From: LingandRX Date: Wed, 27 Nov 2024 22:40:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=9F=A5=E4=B9=8E=E7=83=AD?= =?UTF-8?q?=E6=A6=9C=E5=B1=95=E7=A4=BA=EF=BC=8C=E4=BD=BF=E7=94=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=BC=8F=E6=9B=BF=E4=BB=A3=20div=EF=BC=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=95=B0=E6=8D=AE=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fetch_test.js | 49 ++++++++++++----------------------- zhihu.html | 71 ++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 75 insertions(+), 45 deletions(-) diff --git a/fetch_test.js b/fetch_test.js index 3c2a78c..26f9ef1 100644 --- a/fetch_test.js +++ b/fetch_test.js @@ -176,46 +176,29 @@ const saveFile = `${new Date().getTime()}_zhihu_hot.json`; await pushPlusNotify('知乎热榜更新失败', '请查看日志获取详细信息'); } - function setDiv(item) { - return `
-

${item.shortTitle}

-

热度:${item.popularity}

-

${item.title}

-
`; + function setDiv(item, index) { + return `
  • ${index + 1}. ${item.shortTitle}
  • `; } - let content = zhihu_hot_list.reduce( - (accumulator, currentValue) => accumulator + setDiv(currentValue), - '' - ); + const content = zhihu_hot_list.map((item, index) => setDiv(item, index)).join(''); let html = ` - - - - - 展示 知乎 数据 - - - ${content} - - -`; + `; await pushPlusNotify('知乎热榜已更新', `${getcurrentDate()} 知乎热榜已更新` + html); diff --git a/zhihu.html b/zhihu.html index 17e7dc7..eec45b4 100644 --- a/zhihu.html +++ b/zhihu.html @@ -8,22 +8,69 @@ font-family: Arial, sans-serif; margin: 20px; } - h2 { + ul { + list-style-type: none; + padding: 0; + font-size: 28px; + } + ul li { + margin: 10px 20px; + padding: 10px 20px; + } + + a { + text-decoration: none; color: #333; } - p { - line-height: 1.6; - } - .popularity { - color: #888; - } -
    -

    ${item.shortTitle}

    -

    热度:${item.popularity}

    -

    ${item.title}

    -
    + +