From 3ca7863a80c2cefefd5abecaf1e8ad5f186b5c1b Mon Sep 17 00:00:00 2001 From: RikkaBlue <46104879+RikkaBlue@users.noreply.github.com> Date: Tue, 5 Apr 2022 00:57:00 +0800 Subject: [PATCH] Revert "fetch upstream (#7)" This reverts commit 14de1fdde69f924ab62e77b826aa9b2514a2e419. --- .github/workflows/build-assets.yml | 2 +- .github/workflows/docker-release.yml | 13 -- .github/workflows/format.yml | 2 +- .github/workflows/npm-publish.yml | 2 +- .github/workflows/pr-lint.yml | 2 +- .github/workflows/test.yml | 6 +- README.md | 7 +- docs/.vuepress/components/Route.vue | 7 +- docs/.vuepress/components/RouteEn.vue | 7 +- docs/README.md | 7 +- docs/api.md | 6 +- docs/bbs.md | 62 +++--- docs/en/README.md | 7 +- docs/en/api.md | 2 +- docs/en/joinus/pub-date.md | 8 +- docs/en/journal.md | 14 +- docs/en/parameter.md | 38 ++-- docs/en/picture.md | 6 - docs/en/program-update.md | 6 - docs/en/programming.md | 30 +-- docs/en/reading.md | 20 -- docs/en/shopping.md | 2 +- docs/en/study.md | 16 +- docs/en/travel.md | 32 --- docs/forecast.md | 18 -- docs/game.md | 18 -- docs/government.md | 18 +- docs/install/README.md | 4 - docs/journal.md | 15 +- docs/multimedia.md | 6 - docs/new-media.md | 4 +- docs/parameter.md | 32 +-- docs/picture.md | 6 +- docs/program-update.md | 14 +- docs/programming.md | 70 +------ docs/reading.md | 20 -- docs/social-media.md | 47 ++--- docs/traditional-media.md | 75 +------ docs/travel.md | 34 +--- lib/config.js | 4 - lib/middleware/cache/index.js | 6 +- lib/middleware/cache/memory.js | 16 +- lib/middleware/template.js | 10 +- lib/router.js | 41 ++-- lib/routes/amd/graphicsdrivers.js | 2 +- lib/routes/hupu/all.js | 53 +++++ lib/routes/hupu/bbs.js | 83 ++++++++ lib/routes/hupu/dept.js | 66 ++++++ lib/{v2 => routes}/mpaypass/main.js | 50 ++--- lib/routes/mpaypass/news.js | 43 ++++ lib/routes/natgeo/dailyphoto.js | 27 +++ lib/{v2 => routes}/natgeo/natgeo.js | 50 +++-- lib/routes/pubmed/trending.js | 65 ++++++ lib/routes/quicker/person.js | 32 +++ lib/routes/quicker/qa.js | 41 ++++ lib/routes/quicker/update.js | 30 +++ .../thepaper/839studio/category.js | 0 .../thepaper/839studio/studio.js | 0 lib/{v2 => routes}/thepaper/channel.js | 0 lib/{v2 => routes}/thepaper/featured.js | 0 lib/{v2 => routes}/thepaper/list.js | 0 lib/routes/thepaper/utils.js | 48 +++++ lib/routes/weibo/keyword.js | 28 +-- lib/routes/weibo/super_index.js | 39 ++-- lib/routes/weibo/timeline.js | 51 ++--- lib/routes/weibo/user.js | 68 ++----- lib/routes/weibo/utils.js | 89 +-------- lib/utils/common-utils.js | 14 -- lib/utils/parse-date.js | 188 ++---------------- lib/utils/torrent.js | 10 +- lib/v2/asus/bios.js | 38 ---- lib/v2/asus/maintainer.js | 3 - lib/v2/asus/radar.js | 13 -- lib/v2/asus/router.js | 3 - lib/v2/asus/templates/bios.art | 6 - lib/v2/bilibili/liveArea.js | 14 +- lib/v2/brooklynmuseum/exhibitions.js | 27 --- lib/v2/brooklynmuseum/maintainer.js | 3 - lib/v2/brooklynmuseum/radar.js | 11 - lib/v2/brooklynmuseum/router.js | 3 - lib/v2/douban/people/status.js | 12 +- lib/v2/douban/people/wish.js | 98 ++++----- lib/v2/fortunechina/index.js | 6 +- lib/v2/gov/anhui/kjt.js | 56 ------ lib/v2/gov/maintainer.js | 3 +- lib/v2/gov/radar.js | 166 +++++++--------- lib/v2/gov/router.js | 3 +- lib/v2/gov/sichuan/deyang/govpulicinfo.js | 118 +++++++---- .../deyang/templates/govPublicInfo.art | 1 - lib/v2/guggenheim/exhibitions.js | 29 --- lib/v2/guggenheim/maintainer.js | 3 - lib/v2/guggenheim/radar.js | 11 - lib/v2/guggenheim/router.js | 3 - lib/v2/hameln/chapter.js | 59 ------ lib/v2/hameln/maintainer.js | 3 - lib/v2/hameln/radar.js | 13 -- lib/v2/hameln/router.js | 1 - lib/v2/hnrb/index.js | 85 -------- lib/v2/hnrb/maintainer.js | 3 - lib/v2/hnrb/radar.js | 13 -- lib/v2/hnrb/router.js | 3 - lib/v2/hupu/all.js | 73 ------- lib/v2/hupu/bbs.js | 64 ------ lib/v2/hupu/index.js | 72 ------- lib/v2/hupu/maintainer.js | 7 - lib/v2/hupu/radar.js | 35 ---- lib/v2/hupu/router.js | 7 - lib/v2/hupu/templates/description.art | 6 - lib/v2/hyqss/index.js | 89 --------- lib/v2/hyqss/maintainer.js | 4 - lib/v2/hyqss/radar.js | 22 -- lib/v2/hyqss/router.js | 3 - lib/v2/jewishmuseum/exhibitions.js | 16 -- lib/v2/jewishmuseum/maintainer.js | 3 - lib/v2/jewishmuseum/radar.js | 11 - lib/v2/jewishmuseum/router.js | 3 - lib/v2/kakuyomu/episode.js | 54 ----- lib/v2/kakuyomu/maintainer.js | 3 - lib/v2/kakuyomu/radar.js | 13 -- lib/v2/kakuyomu/router.js | 1 - lib/v2/kyodonews/index.js | 123 ------------ lib/v2/kyodonews/maintainer.js | 3 - lib/v2/kyodonews/radar.js | 33 --- lib/v2/kyodonews/router.js | 3 - lib/v2/kyodonews/templates/article.art | 4 - lib/v2/mcachicago/exhibitions.js | 17 -- lib/v2/mcachicago/maintainer.js | 3 - lib/v2/mcachicago/radar.js | 11 - lib/v2/mcachicago/router.js | 3 - lib/v2/metmuseum/exhibitions.js | 31 --- lib/v2/metmuseum/maintainer.js | 3 - lib/v2/metmuseum/radar.js | 11 - lib/v2/metmuseum/router.js | 3 - lib/v2/mihoyo/bbs.js | 62 ------ lib/v2/mihoyo/maintainer.js | 3 - lib/v2/mihoyo/radar.js | 31 --- lib/v2/mihoyo/router.js | 3 - lib/v2/mihoyo/templates/description.art | 6 - lib/v2/mpaypass/maintainer.js | 4 - lib/v2/mpaypass/news.js | 39 ---- lib/v2/mpaypass/radar.js | 19 -- lib/v2/mpaypass/router.js | 4 - lib/v2/mtime/maintainer.js | 3 - lib/v2/mtime/news.js | 48 ----- lib/v2/mtime/radar.js | 13 -- lib/v2/mtime/router.js | 3 - lib/v2/natgeo/dailyphoto.js | 32 --- lib/v2/natgeo/dailyselection.js | 41 ---- lib/v2/natgeo/maintainer.js | 5 - lib/v2/natgeo/radar.js | 24 --- lib/v2/natgeo/router.js | 5 - lib/v2/natgeo/templates/dailyPhoto.art | 5 - lib/v2/newmuseum/exhibitions.js | 27 --- lib/v2/newmuseum/maintainer.js | 3 - lib/v2/newmuseum/radar.js | 11 - lib/v2/newmuseum/router.js | 3 - lib/v2/npm/maintainer.js | 3 - lib/v2/npm/package.js | 45 ----- lib/v2/npm/radar.js | 13 -- lib/v2/npm/router.js | 3 - lib/v2/npm/templates/package.art | 10 - lib/v2/picuki/profile.js | 15 +- lib/v2/pubmed/maintainer.js | 3 - lib/v2/pubmed/radar.js | 13 -- lib/v2/pubmed/router.js | 3 - lib/v2/pubmed/templates/description.art | 7 - lib/v2/pubmed/trending.js | 58 ------ lib/v2/quicker/maintainer.js | 7 - lib/v2/quicker/qa.js | 65 ------ lib/v2/quicker/radar.js | 31 --- lib/v2/quicker/router.js | 7 - lib/v2/quicker/share.js | 61 ------ lib/v2/quicker/user.js | 62 ------ lib/v2/quicker/versions.js | 36 ---- lib/v2/qweather/3days.js | 46 ----- lib/v2/qweather/maintainer.js | 4 - lib/v2/qweather/now.js | 46 ----- lib/v2/qweather/router.js | 4 - lib/v2/qweather/util/3days.art | 20 -- lib/v2/qweather/util/now.art | 16 -- lib/v2/telegram/channel.js | 16 +- lib/v2/test/index.js | 2 +- lib/v2/thepaper/factpaper.js | 61 ------ lib/v2/thepaper/maintainer.js | 8 - lib/v2/thepaper/radar.js | 42 ---- lib/v2/thepaper/router.js | 8 - lib/v2/thepaper/templates/factpaper.art | 12 -- lib/v2/thepaper/utils.js | 55 ----- lib/v2/zooTeam/blog.js | 32 --- lib/v2/zooTeam/maintainer.js | 4 - lib/v2/zooTeam/radar.js | 21 -- lib/v2/zooTeam/router.js | 4 - lib/v2/zooTeam/weekly.js | 34 ---- lib/views/atom.art | 6 +- package.json | 20 +- test/middleware/template.js | 6 +- test/utils/common-utils.js | 29 --- test/utils/parse-date.js | 154 -------------- yarn.lock | 174 ++++++++-------- 199 files changed, 1147 insertions(+), 3896 deletions(-) create mode 100644 lib/routes/hupu/all.js create mode 100644 lib/routes/hupu/bbs.js create mode 100644 lib/routes/hupu/dept.js rename lib/{v2 => routes}/mpaypass/main.js (52%) create mode 100644 lib/routes/mpaypass/news.js create mode 100644 lib/routes/natgeo/dailyphoto.js rename lib/{v2 => routes}/natgeo/natgeo.js (53%) create mode 100644 lib/routes/pubmed/trending.js create mode 100644 lib/routes/quicker/person.js create mode 100644 lib/routes/quicker/qa.js create mode 100644 lib/routes/quicker/update.js rename lib/{v2 => routes}/thepaper/839studio/category.js (100%) rename lib/{v2 => routes}/thepaper/839studio/studio.js (100%) rename lib/{v2 => routes}/thepaper/channel.js (100%) rename lib/{v2 => routes}/thepaper/featured.js (100%) rename lib/{v2 => routes}/thepaper/list.js (100%) create mode 100644 lib/routes/thepaper/utils.js delete mode 100644 lib/v2/asus/bios.js delete mode 100644 lib/v2/asus/maintainer.js delete mode 100644 lib/v2/asus/radar.js delete mode 100644 lib/v2/asus/router.js delete mode 100644 lib/v2/asus/templates/bios.art delete mode 100644 lib/v2/brooklynmuseum/exhibitions.js delete mode 100644 lib/v2/brooklynmuseum/maintainer.js delete mode 100644 lib/v2/brooklynmuseum/radar.js delete mode 100644 lib/v2/brooklynmuseum/router.js delete mode 100644 lib/v2/gov/anhui/kjt.js delete mode 100644 lib/v2/guggenheim/exhibitions.js delete mode 100644 lib/v2/guggenheim/maintainer.js delete mode 100644 lib/v2/guggenheim/radar.js delete mode 100644 lib/v2/guggenheim/router.js delete mode 100644 lib/v2/hameln/chapter.js delete mode 100644 lib/v2/hameln/maintainer.js delete mode 100644 lib/v2/hameln/radar.js delete mode 100644 lib/v2/hameln/router.js delete mode 100644 lib/v2/hnrb/index.js delete mode 100644 lib/v2/hnrb/maintainer.js delete mode 100644 lib/v2/hnrb/radar.js delete mode 100644 lib/v2/hnrb/router.js delete mode 100644 lib/v2/hupu/all.js delete mode 100644 lib/v2/hupu/bbs.js delete mode 100644 lib/v2/hupu/index.js delete mode 100644 lib/v2/hupu/maintainer.js delete mode 100644 lib/v2/hupu/radar.js delete mode 100644 lib/v2/hupu/router.js delete mode 100644 lib/v2/hupu/templates/description.art delete mode 100644 lib/v2/hyqss/index.js delete mode 100644 lib/v2/hyqss/maintainer.js delete mode 100644 lib/v2/hyqss/radar.js delete mode 100644 lib/v2/hyqss/router.js delete mode 100644 lib/v2/jewishmuseum/exhibitions.js delete mode 100644 lib/v2/jewishmuseum/maintainer.js delete mode 100644 lib/v2/jewishmuseum/radar.js delete mode 100644 lib/v2/jewishmuseum/router.js delete mode 100644 lib/v2/kakuyomu/episode.js delete mode 100644 lib/v2/kakuyomu/maintainer.js delete mode 100644 lib/v2/kakuyomu/radar.js delete mode 100644 lib/v2/kakuyomu/router.js delete mode 100644 lib/v2/kyodonews/index.js delete mode 100644 lib/v2/kyodonews/maintainer.js delete mode 100644 lib/v2/kyodonews/radar.js delete mode 100644 lib/v2/kyodonews/router.js delete mode 100644 lib/v2/kyodonews/templates/article.art delete mode 100644 lib/v2/mcachicago/exhibitions.js delete mode 100644 lib/v2/mcachicago/maintainer.js delete mode 100644 lib/v2/mcachicago/radar.js delete mode 100644 lib/v2/mcachicago/router.js delete mode 100644 lib/v2/metmuseum/exhibitions.js delete mode 100644 lib/v2/metmuseum/maintainer.js delete mode 100644 lib/v2/metmuseum/radar.js delete mode 100644 lib/v2/metmuseum/router.js delete mode 100644 lib/v2/mihoyo/bbs.js delete mode 100644 lib/v2/mihoyo/maintainer.js delete mode 100644 lib/v2/mihoyo/radar.js delete mode 100644 lib/v2/mihoyo/router.js delete mode 100644 lib/v2/mihoyo/templates/description.art delete mode 100644 lib/v2/mpaypass/maintainer.js delete mode 100644 lib/v2/mpaypass/news.js delete mode 100644 lib/v2/mpaypass/radar.js delete mode 100644 lib/v2/mpaypass/router.js delete mode 100644 lib/v2/mtime/maintainer.js delete mode 100644 lib/v2/mtime/news.js delete mode 100644 lib/v2/mtime/radar.js delete mode 100644 lib/v2/mtime/router.js delete mode 100644 lib/v2/natgeo/dailyphoto.js delete mode 100644 lib/v2/natgeo/dailyselection.js delete mode 100644 lib/v2/natgeo/maintainer.js delete mode 100644 lib/v2/natgeo/radar.js delete mode 100644 lib/v2/natgeo/router.js delete mode 100644 lib/v2/natgeo/templates/dailyPhoto.art delete mode 100644 lib/v2/newmuseum/exhibitions.js delete mode 100644 lib/v2/newmuseum/maintainer.js delete mode 100644 lib/v2/newmuseum/radar.js delete mode 100644 lib/v2/newmuseum/router.js delete mode 100644 lib/v2/npm/maintainer.js delete mode 100644 lib/v2/npm/package.js delete mode 100644 lib/v2/npm/radar.js delete mode 100644 lib/v2/npm/router.js delete mode 100644 lib/v2/npm/templates/package.art delete mode 100644 lib/v2/pubmed/maintainer.js delete mode 100644 lib/v2/pubmed/radar.js delete mode 100644 lib/v2/pubmed/router.js delete mode 100644 lib/v2/pubmed/templates/description.art delete mode 100644 lib/v2/pubmed/trending.js delete mode 100644 lib/v2/quicker/maintainer.js delete mode 100644 lib/v2/quicker/qa.js delete mode 100644 lib/v2/quicker/radar.js delete mode 100644 lib/v2/quicker/router.js delete mode 100644 lib/v2/quicker/share.js delete mode 100644 lib/v2/quicker/user.js delete mode 100644 lib/v2/quicker/versions.js delete mode 100644 lib/v2/qweather/3days.js delete mode 100644 lib/v2/qweather/maintainer.js delete mode 100644 lib/v2/qweather/now.js delete mode 100644 lib/v2/qweather/router.js delete mode 100644 lib/v2/qweather/util/3days.art delete mode 100644 lib/v2/qweather/util/now.art delete mode 100644 lib/v2/thepaper/factpaper.js delete mode 100644 lib/v2/thepaper/maintainer.js delete mode 100644 lib/v2/thepaper/radar.js delete mode 100644 lib/v2/thepaper/router.js delete mode 100644 lib/v2/thepaper/templates/factpaper.art delete mode 100644 lib/v2/thepaper/utils.js delete mode 100644 lib/v2/zooTeam/blog.js delete mode 100644 lib/v2/zooTeam/maintainer.js delete mode 100644 lib/v2/zooTeam/radar.js delete mode 100644 lib/v2/zooTeam/router.js delete mode 100644 lib/v2/zooTeam/weekly.js delete mode 100644 test/utils/parse-date.js diff --git a/.github/workflows/build-assets.yml b/.github/workflows/build-assets.yml index 6fe91d35a07feb..4cb80425c691d8 100644 --- a/.github/workflows/build-assets.yml +++ b/.github/workflows/build-assets.yml @@ -15,7 +15,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Use Node.js v14 - uses: actions/setup-node@v3.1.0 + uses: actions/setup-node@v3.0.0 with: node-version: '14' cache: 'yarn' diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 1c630d4421f16c..78c930f0c71dea 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -63,16 +63,3 @@ jobs: platforms: linux/amd64,linux/arm/v7,linux/arm64 cache-from: type=gha,scope=docker-release cache-to: type=gha,mode=max,scope=docker-release - description: - runs-on: ubuntu-latest - needs: check-env - if: needs.check-env.outputs.check-docker == 'true' - steps: - - uses: actions/checkout@v3 - - - name: Docker Hub Description - uses: peter-evans/dockerhub-description@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: ${{ secrets.DOCKER_USERNAME }}/rsshub diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 72c2454c8b8ba4..75b5909add4fa1 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3.1.0 + - uses: actions/setup-node@v3.0.0 with: node-version: '14' cache: 'yarn' diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 5bd25fecaf6538..653ebac50322d2 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3.1.0 + - uses: actions/setup-node@v3.0.0 with: node-version: '14' cache: 'yarn' diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index d3ccf8fbdc548b..5a1890ee8af14a 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3.1.0 + - uses: actions/setup-node@v3.0.0 with: node-version: '14' cache: 'yarn' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f9671f75a7936..e45e89fae3dfad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: name: Jest on Node ${{ matrix.node-version }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3.1.0 + - uses: actions/setup-node@v3.0.0 with: node-version: ${{ matrix.node-version }} cache: 'yarn' @@ -38,7 +38,7 @@ jobs: name: Build docs on Node ${{ matrix.node-version }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3.1.0 + - uses: actions/setup-node@v3.0.0 with: node-version: ${{ matrix.node-version }} cache: 'yarn' @@ -54,7 +54,7 @@ jobs: name: Build radar and maintainer on Node ${{ matrix.node-version }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3.1.0 + - uses: actions/setup-node@v3.0.0 with: node-version: ${{ matrix.node-version }} cache: 'yarn' diff --git a/README.md b/README.md index 4189908ae1f13d..4215c52ba9b1ed 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,9 @@ > 🍰 Everything is RSSible -[![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?logo=telegram&style=flat-square)](https://t.me/rsshub) -[![npm publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/publish/master?label=npm%20publish&logo=npm&style=flat-square)](https://www.npmjs.com/package/rsshub) -[![docker publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/%5Bdocker%5D%20CI%20for%20releases/master?label=docker%20publish&logo=docker&style=flat-square)](https://hub.docker.com/r/diygod/rsshub) -[![test](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/test/master?label=test&logo=github&style=flat-square)](https://github.com/DIYgod/RSSHub/actions/workflows/test.yml?query=event%3Apush+branch%3Amaster) +[![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?style=flat-square)](https://t.me/rsshub) +[![build status](https://img.shields.io/travis/DIYgod/RSSHub/master.svg?style=flat-square)](https://travis-ci.org/DIYgod/RSSHub) +[![Test coverage](https://img.shields.io/codecov/c/github/DIYgod/RSSHub.svg?style=flat-square)](https://codecov.io/github/DIYgod/RSSHub?branch=master) ## Introduction diff --git a/docs/.vuepress/components/Route.vue b/docs/.vuepress/components/Route.vue index 8442eec86d8710..a83a40db5415c1 100644 --- a/docs/.vuepress/components/Route.vue +++ b/docs/.vuepress/components/Route.vue @@ -15,8 +15,7 @@

参数: -

- +

参数: 无

@@ -71,11 +70,11 @@ export default { }, }, methods: { - renderMarkdown(item, inline = true) { + renderMarkdown(item) { const md = require('markdown-it')({ html: true, }); - return inline ? md.renderInline(item) : md.render(item); + return md.render(item); }, }, computed: { diff --git a/docs/.vuepress/components/RouteEn.vue b/docs/.vuepress/components/RouteEn.vue index 1e964fc00b328b..11443c33eb9fe5 100644 --- a/docs/.vuepress/components/RouteEn.vue +++ b/docs/.vuepress/components/RouteEn.vue @@ -15,8 +15,7 @@

Parameters: -

- +

Parameters: N/A

@@ -67,11 +66,11 @@ export default { }, }, methods: { - renderMarkdown(item, inline = true) { + renderMarkdown(item) { const md = require('markdown-it')({ html: true, }); - return inline ? md.renderInline(item) : md.render(item); + return md.render(item); }, }, computed: { diff --git a/docs/README.md b/docs/README.md index f691f1073b0fed..c0ee39bc8af47f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,10 +11,9 @@ sidebarDepth: 0 > 🍰 万物皆可 RSS -[![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?logo=telegram\&style=flat-square)](https://t.me/rsshub) -[![npm publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/publish/master?label=npm%20publish\&logo=npm\&style=flat-square)](https://www.npmjs.com/package/rsshub) -[![docker publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/%5Bdocker%5D%20CI%20for%20releases/master?label=docker%20publish\&logo=docker\&style=flat-square)](https://hub.docker.com/r/diygod/rsshub) -[![test](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/test/master?label=test\&logo=github\&style=flat-square)](https://github.com/DIYgod/RSSHub/actions/workflows/test.yml?query=event%3Apush+branch%3Amaster) +[![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?style=flat-square)](https://t.me/rsshub) +[![build status](https://img.shields.io/travis/DIYgod/RSSHub/master.svg?style=flat-square)](https://travis-ci.org/DIYgod/RSSHub) +[![Test coverage](https://img.shields.io/codecov/c/github/DIYgod/RSSHub.svg?style=flat-square)](https://codecov.io/github/DIYgod/RSSHub?branch=master) RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以给任何奇奇怪怪的内容生成 RSS 订阅源。RSSHub 借助于开源社区的力量快速发展中,目前已适配数百家网站的上千项内容 diff --git a/docs/api.md b/docs/api.md index 11eeebcfab5da8..212237619c8368 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,10 +1,10 @@ -# API +# API 接口 ::: warning 注意 API 仍处于开发状态中, 并可能会有改动。欢迎提供建议! ::: -RSSHub 提供下列 API: +RSSHub 提供下列 API 接口: ### 可用公共路由列表 @@ -18,7 +18,7 @@ RSSHub 提供下列 API: 参数: -- `name`, 路由一级名称,对应 中的文件夹名称。可选,**缺省则返回所有可用路由**. +- name, 路由一级名称,对应 中的文件夹名称。可选,**缺省则返回所有可用路由**. 成功请求将会返回 HTTP 状态码 `200 OK` 与 JSON 结果,格式如下: diff --git a/docs/bbs.md b/docs/bbs.md index 003f265bd8fb45..a5de6467398fd8 100644 --- a/docs/bbs.md +++ b/docs/bbs.md @@ -218,6 +218,16 @@ pageClass: routes +## Quicker + +### 讨论区 + + + +### 用户动作更新 + + + ## RF 技术社区 ### 文章 @@ -346,43 +356,47 @@ pageClass: routes ## 虎扑 -### 首页 - - - -| NBA | CBA | 足球 | -| --- | --- | ------ | -| nba | cba | soccer | - -::: tip 提示 +### 虎扑 BBS 论坛 -电竞分类参见 [游戏热帖](https://bbs.hupu.com/all-gg) 的对应路由 [`/hupu/all/all-gg`](https://rsshub.app/hupu/all/all-gg)。 + -::: +此路由与旧的 `/hupu/bxj/:id/:order?` 等价,但推荐使用 `/hupu/bbs/:id/:order?`,旧路由可能会在未来被删除。 -### 社区 - - +### 分类 -::: tip 提示 + -更多社区参见 [社区](https://m.hupu.com/bbs) +| 分类 | 名称 | +| ------ | -------- | +| NBA 论坛 | nba | +| CBA 论坛 | cba | +| 运动和装备 | gear | +| 国际足球论坛 | soccer | +| 中国足球论坛 | csl | +| 综合体育 | sports | +| 步行街 | gambia | +| 彩票中心 | lottery | +| 自建版块 | boards | +| 虎扑社团 | group | +| 站务管理 | feedback | -::: +更多参见 [虎扑社区版块目录](https://bbs.hupu.com/boards.php) 左侧导航栏各板块分类页 -### 热帖 - - +### 子站 -::: tip 提示 + -更多热帖版面参见 [论坛](https://bbs.hupu.com) - -::: +| 子站 | 名称 | +| ---- | ------------ | +| NBA | nba | +| 国际足球 | soccer | +| 中国足球 | soccer-china | +| CBA | cba | +| 电竞 | gg | diff --git a/docs/en/README.md b/docs/en/README.md index 8871eb52217b05..5812ae7e574b13 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -11,10 +11,9 @@ sidebarDepth: 0 > 🍰 Everything is RSSible -[![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?logo=telegram&style=flat-square)](https://t.me/rsshub) -[![npm publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/publish/master?label=npm%20publish&logo=npm&style=flat-square)](https://www.npmjs.com/package/rsshub) -[![docker publish](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/%5Bdocker%5D%20CI%20for%20releases/master?label=docker%20publish&logo=docker&style=flat-square)](https://hub.docker.com/r/diygod/rsshub) -[![test](https://img.shields.io/github/workflow/status/DIYgod/RSSHub/test/master?label=test&logo=github&style=flat-square)](https://github.com/DIYgod/RSSHub/actions/workflows/test.yml?query=event%3Apush+branch%3Amaster) +[![telegram](https://img.shields.io/badge/chat-telegram-brightgreen.svg?style=flat-square)](https://t.me/rsshub) +[![build status](https://img.shields.io/travis/DIYgod/RSSHub/master.svg?style=flat-square)](https://travis-ci.org/DIYgod/RSSHub) +[![Test coverage](https://img.shields.io/codecov/c/github/DIYgod/RSSHub.svg?style=flat-square)](https://codecov.io/github/DIYgod/RSSHub?branch=master) RSSHub is an open source, easy to use, and extensible RSS feed aggregator, it's capable of generating RSS feeds from pretty much everything. diff --git a/docs/en/api.md b/docs/en/api.md index acf95f470788b4..90d199dff975f2 100644 --- a/docs/en/api.md +++ b/docs/en/api.md @@ -18,7 +18,7 @@ Route: `/api/routes/:name?` Parameters: -- `name`, route's top level name as in [https://github.com/DIYgod/RSSHub/tree/master/lib/routes](https://github.com/DIYgod/RSSHub/tree/master/lib/routes). Optional, **returns all public routes if not specified**. +- name, route's top level name as in [https://github.com/DIYgod/RSSHub/tree/master/lib/routes](https://github.com/DIYgod/RSSHub/tree/master/lib/routes). Optional, **returns all public routes if not specified**. A successful request returns a HTTP status code `200 OK` with the result in JSON: diff --git a/docs/en/joinus/pub-date.md b/docs/en/joinus/pub-date.md index 0435e5d8e96037..bddeed79e0faa1 100644 --- a/docs/en/joinus/pub-date.md +++ b/docs/en/joinus/pub-date.md @@ -33,11 +33,15 @@ const pubDate = parseDate('2020/12/30', 'YYYY/MM/DD'); If you need to parse a relative date, use `parseRelativeDate`. +::: warning Warning +Only works for relative date in Chinese for now +::: + ```javascript const { parseRelativeDate } = require('@/utils/parse-date'); -const pubDate = parseRelativeDate('2 days ago'); -const pubDate = parseRelativeDate('day before yesterday 15:36'); +const pubDate = parseRelativeDate('2天前'); +const pubDate = parseRelativeDate('前天 15:36'); ``` ### Timezone diff --git a/docs/en/journal.md b/docs/en/journal.md index 55fc8f4512abb8..190401f70e3456 100644 --- a/docs/en/journal.md +++ b/docs/en/journal.md @@ -262,19 +262,9 @@ Subscribe to the cover images of the Nature journals, and get the latest publica ## PubMed -### Trending articles +### Trending - - -::: tip Tip - -For the parameter **filter**, the `filter` parameter in the URL should be split into a string by `,`, here is an example. - -In , the filter parameters are `simsearch1.fha`, `pubt.clinicaltrial`, and `pubt.randomizedcontrolledtrial`. Therefore, the filter corresponding to the route should be filled with `simsearch1.fha,pubt.clinicaltrial,pubt.randomizedcontrolledtrial`, and the route is [`/pubmed/trending/simsearch1.fha,pubt .clinicaltrial,pubt.randomizedcontrolledtrial`](https://rsshub.app/pubmed/trending/simsearch1.fha,pubt.clinicaltrial,pubt.randomizedcontrolledtrial) - -::: - - + ## Science Journal diff --git a/docs/en/parameter.md b/docs/en/parameter.md index 9db8a9b59159a4..6f2abb85b3b51d 100644 --- a/docs/en/parameter.md +++ b/docs/en/parameter.md @@ -2,7 +2,7 @@ ::: tip -The parameters can be linked with `&` to used together to generate a complex feed. +All parameters can be linked with `&` to used together to generate a complex feed. ::: @@ -12,27 +12,27 @@ The following URL query parameters are supported, Regex support is built-in. Set `filter` to include the content -- `filter`: filter `title` and description +- filter: filter title and description -- `filter_title`: filter `title` only +- filter_title: filter title only -- `filter_description`: filter `description` only +- filter_description: filter description only -- `filter_author`: filter `author` only +- filter_author: filter author only -- `filter_time`: filter `pubDate`, in seconds, return specified time range. Item without `pubDate` will not be filtered. +- filter_time: filter pubDate, value for second number, return specified time range. Item without `pubDate` will not be filtered. For example: [https://rsshub.app/dribbble/popular?filter=Blue|Yellow|Black](https://rsshub.app/dribbble/popular?filter=Blue|Yellow|Black) Set `filterout` to exclude unwanted content. -- `filterout`: filter `title` and description +- filterout: filter title and description -- `filterout_title`: filter `title` only +- filterout_title: filter title only -- `filterout_description`: filter `description` only +- filterout_description: filter description only -- `filterout_author`: filter `author` only +- filterout_author: filter author only For example: [https://rsshub.app/dribbble/popular?filterout=Blue|Yellow|Black](https://rsshub.app/dribbble/popular?filterout=Blue|Yellow|Black) @@ -46,13 +46,13 @@ Example: [https://rsshub.app/dribbble/popular?filter=BluE|yeLLow|BlaCK&filter_ca Set `limit` to limit the number of articles in the feed. -E.g. Dribbble Popular Top 10 [https://rsshub.app/dribbble/popular?limit=10](https://rsshub.app/dribbble/popular?limit=10) +Eg: Dribbble Popular Top 10 [https://rsshub.app/dribbble/popular?limit=10](https://rsshub.app/dribbble/popular?limit=10) ## Fulltext Enable fulltext via `mode` parameter. -E.g. Bilibili article +Eg: bilibili article ## Access Control @@ -64,27 +64,27 @@ Replace website link with Telegram's Instant View link. Enable Telegram Instant View requires a page template, it can be obtained from Telegram's [Instant View page](https://instantview.telegram.org/) -- `tgiv`: template hash, obtained from the link of template page generated(the string after `&rhash=`) +- tgiv: template hash, obtained from the link of template page generated(the string after `&rhash=`) -E.g. +Eg: ## Sci-hub link Output Sci-hub link in scientific journal routes, this supports major journals or routes that output DOIs. -- `scihub`: set to any value +- scihub: set to any value -E.g. +Eg: ## Conversion between Traditional and Simplified Chinese -- `opencc`: `s2t` (Simplified Chinese to Traditional Chinese)、`t2s` (Traditional Chinese to Simplified Chinese), other optional values refer to [simplecc-wasm - Configurations](https://github.com/fengkx/simplecc-wasm#%E9%85%8D%E7%BD%AE-configurations) +- opencc: s2t (Simplified Chinese to Traditional Chinese)、t2s (Traditional Chinese to Simplified Chinese), other optional values refer to [simplecc-wasm - Configurations](https://github.com/fengkx/simplecc-wasm#%E9%85%8D%E7%BD%AE-configurations) -E.g. +Eg: ## Output Formats -RSSHub conforms to RSS 2.0 and Atom Standard, simply append `.rss` `.atom` to the end of the feed address to obtain the feed in corresponding format. The default output format is RSS 2.0. +RSSHub conforms to RSS 2.0 and Atom Standard, simply append `.rss` `.atom` to the end of the feed address to obtain the feed in corresponding format, default to RSS 2.0. For example: diff --git a/docs/en/picture.md b/docs/en/picture.md index cc070b3addc216..651408c0a92297 100644 --- a/docs/en/picture.md +++ b/docs/en/picture.md @@ -197,12 +197,6 @@ For example: -## National Geographic - -### Photo of the Day - - - ## nHentai ### Filter diff --git a/docs/en/program-update.md b/docs/en/program-update.md index feb4b429dbee8d..88a60b886aa2c7 100644 --- a/docs/en/program-update.md +++ b/docs/en/program-update.md @@ -269,12 +269,6 @@ Refer to [#minecraft](/en/game.html#minecraft) 见 [#nintendo](/game.html#nintendo) -## NPM - -### Package - - - ## Nvidia Web Driver ### Changelog diff --git a/docs/en/programming.md b/docs/en/programming.md index da7d0281b85dd1..d705226d04773d 100644 --- a/docs/en/programming.md +++ b/docs/en/programming.md @@ -70,11 +70,11 @@ Category ### Commits - + ### Tags - + ## Bitmovin @@ -125,15 +125,15 @@ GitHub provides some official RSS feeds: -| Parameter | Description | Values | -| --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | -| `l` | Language | For instance `php`, which can be found in the URL of the corresponding [Topics page](https://github.com/topics/framework?l=php) | -| `o` | Sorting Order | `asc`, `desc` | -| `s` | Sorting Criteria | `stars`, `forks`, `updated` | +| Parameter | Description | Values | +| ---- | ---- | ---- | +| `l` | Language | For instance `php`, which can be found in the URL of the corresponding [Topics page](https://github.com/topics/framework?l=php) | +| `o` | Sorting Order | `asc`, `desc` | +| `s` | Sorting Criteria | `stars`, `forks`, `updated` | For instance, the `/github/topics/framework/l=php&o=desc&s=stars` route will generate the RSS feed corresponding to this [page](https://github.com/topics/framework?l=php&o=desc&s=stars). - + ### Repo Issues @@ -174,7 +174,7 @@ For instance, the `/github/topics/framework/l=php&o=desc&s=stars` route will gen ### Search Result - + | Sort options | sort | | ---------------- | --------- | @@ -183,8 +183,6 @@ For instance, the `/github/topics/framework/l=php&o=desc&s=stars` route will gen | Most forks | forks | | Recently updated | updated | - - ### User Starred Repositories @@ -377,13 +375,3 @@ Subscribe to the updates (threads and submission) from a paritcular Hacker News | featured | trending | trending_m | trending_d | popular | new | - -## zooTeam - -### blog - - - -### weekly - - diff --git a/docs/en/reading.md b/docs/en/reading.md index 55e47b04cd7cf1..6226d1835dc8d2 100644 --- a/docs/en/reading.md +++ b/docs/en/reading.md @@ -10,26 +10,6 @@ pageClass: routes -## hameln - -### chapter - - - -Eg: - - - -## kakuyomu - -### episode - - - -Eg: - - - ## Literotica ### New Stories diff --git a/docs/en/shopping.md b/docs/en/shopping.md index 5c4188c24f9d77..3d26b32f797325 100644 --- a/docs/en/shopping.md +++ b/docs/en/shopping.md @@ -52,7 +52,7 @@ Parameter `time` only works when `mostwanted` is chosen as the category. ### thread - + ## IKEA diff --git a/docs/en/study.md b/docs/en/study.md index 1037018416946e..58fc55e93a487d 100644 --- a/docs/en/study.md +++ b/docs/en/study.md @@ -33,13 +33,13 @@ pageClass: routes | thumbnail | Thumbnail size | | poster | Art poster | - + ## LinkResearch ### theses - + | `:param` | example | definition | | -------- | --------------- | -------------------------------------- | @@ -48,13 +48,11 @@ pageClass: routes | columns | columns=健康 | string / undefined | | columns | columns=virus | string / undefined | - - ## ORCID ### Works List - + ## X-MOL @@ -78,7 +76,7 @@ pageClass: routes ### News - + | `:type` | type name | | --------- | --------- | @@ -92,15 +90,13 @@ pageClass: routes > leave it blank(`/zhishifenzi/news`)to get all - - ### depth ### innovation - + | `:type` | type name | | ------------- | ------------- | @@ -112,5 +108,3 @@ pageClass: routes | policy | Policy | > leave it blank(`/zhishifenzi/innovation`)to get all - - diff --git a/docs/en/travel.md b/docs/en/travel.md index 5b198a85e1dd78..c052ced98b54c5 100644 --- a/docs/en/travel.md +++ b/docs/en/travel.md @@ -20,14 +20,6 @@ If the city name contains a space like `Mexico City`, replace the space with `%2 -## Brooklyn Museum - - - ## Hopper ### Flight Deals @@ -39,27 +31,3 @@ This route returns a list of flight deals (in most cases, 6 flight deals) for a For airport IATA code please refer to [Wikipedia List of airports by IATA code](https://en.wikipedia.org/wiki/List_of_airports_by_IATA_code:_A) - -## Museum of Contemporary Art Chicago - - - -## New Museum - - - -## Solomon R. Guggenheim Museum - - - -## The Jewish Museum - - - -## The Metropolitan Museum of Art - - diff --git a/docs/forecast.md b/docs/forecast.md index 73b15b6daa975e..3285969adc778e 100644 --- a/docs/forecast.md +++ b/docs/forecast.md @@ -58,24 +58,6 @@ pageClass: routes -## 和风天气 - -### 近三天天气 - - - -需自行注册获取 api 的 key,并在环境变量 HEFENG_KEY 中进行配置,获取订阅近三天天气预报 - - - -### 实时天气 - - - -需自行注册获取 api 的 key,每小时更新一次数据 - - - ## 上海市生态环境局 ### 空气质量 diff --git a/docs/game.md b/docs/game.md index 26be3619cd64d4..abbe05e8b1d2db 100644 --- a/docs/game.md +++ b/docs/game.md @@ -573,24 +573,6 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` -### 米游社 - 官方公告 - - - -游戏 id - -| 崩坏三 | 原神 | 崩坏二 | 未定事件簿 | 星穹铁道 | -| --- | -- | --- | ----- | ---- | -| 1 | 2 | 3 | 4 | 6 | - -公告类型 - -| 公告 | 活动 | 资讯 | -| -- | -- | -- | -| 1 | 2 | 3 | - - - ## 明日方舟 ### 游戏公告与新闻 diff --git a/docs/government.md b/docs/government.md index 07cb278c7f21d8..63c1c0ee78c2ff 100644 --- a/docs/government.md +++ b/docs/government.md @@ -4,22 +4,6 @@ pageClass: routes # 政务消息 -## 安徽省科技厅 - -### 科技资讯 & 科技资源 - - - -::: tip 提示 - -路径处填写对应页面 URL 中 `http://kjt.ah.gov.cn/` 和 `/index.html` 之间的字段。下面是一个例子。 - -若订阅 [通知公告](http://kjt.ah.gov.cn/kjzx/tzgg/index.html) 则将对应页面 URL 中 `http://kjt.ah.gov.cn/` 和 `/index.html` 之间的字段 `kjzx/tzgg` 作为路径填入。此时路由为 [`/gov/anhui/kjt/kjzx/tzgg`](https://rsshub.app/gov/anhui/kjt/kjzx/tzgg) - -::: - - - ## 澳门廉政公署 ### 最新消息 @@ -96,7 +80,7 @@ pageClass: routes ### 德阳市政府公开信息 - + ## 广东省人民政府 diff --git a/docs/install/README.md b/docs/install/README.md index 75ca6bb0156ef8..b29ba9cd3c4048 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -700,10 +700,6 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 - `FANFOU_USERNAME`: 饭否登录用户名、邮箱、手机号 - `FANFOU_PASSWORD`: 饭否密码 -- 和风天气:[申请地址](https://id.qweather.com/#/register?redirect=https%3A%2F%2Fconsole.qweather.com) - - - `HEFENG_KEY`:API key - - 南方周末付费全文 - `INFZM_COOKIE`: infzm 账户登陆后的 cookie,目前只需要 `passport_session=...` 即可获取全文 diff --git a/docs/journal.md b/docs/journal.md index d67c9404ff80f5..af63f42fb99128 100644 --- a/docs/journal.md +++ b/docs/journal.md @@ -231,19 +231,9 @@ pageClass: routes ## PubMed -### Trending articles +### 热门文章 - - -::: tip 提示 - -对于参数 **过滤条件**,应将 URL 中的 filter 参数用 `,` 分割成一个字段填入,下面是一个例子。 - - 中 filter 参数有 `simsearch1.fha` `pubt.clinicaltrial` `pubt.randomizedcontrolledtrial` 三者。所以,对应到路由的 filter 应填入 `simsearch1.fha,pubt.clinicaltrial,pubt.randomizedcontrolledtrial`,于是可获得路由 [`/pubmed/trending/simsearch1.fha,pubt.clinicaltrial,pubt.randomizedcontrolledtrial`](https://rsshub.app/pubmed/trending/simsearch1.fha,pubt.clinicaltrial,pubt.randomizedcontrolledtrial) - -::: - - + ## Science 系列 @@ -298,7 +288,6 @@ pageClass: routes 在 Stork 上注册并订阅关键词后,在 `我的` -> `关键词` 中可找到对应关键词的订阅 URL。URL 后的两个参数即为路由参数。 - ## X-MOL 平台 ### 期刊 diff --git a/docs/multimedia.md b/docs/multimedia.md index cecbc540372077..d96a19cf2877e1 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -1328,12 +1328,6 @@ JavDB 有多个备用域名,本路由默认使用永久域名 -## 时光网 - -### 资讯 - - - ## 腾讯视频 ### 播放列表 diff --git a/docs/new-media.md b/docs/new-media.md index bfc496e4338360..1eba0ecb242df0 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -3714,12 +3714,12 @@ column 为 third 时可选的 category: ### 新闻 - + ### 分类 +:paramsDesc="['新闻类型,类型可在URL中找到,类似policy,eye等,空或其他任意值展示最新新闻']"/> ## 亿欧网 diff --git a/docs/parameter.md b/docs/parameter.md index 034a193d10cbd7..747747c8f31a1f 100644 --- a/docs/parameter.md +++ b/docs/parameter.md @@ -8,38 +8,38 @@ ## 内容过滤 -可以使用以下 URL query 过滤内容,支持通过正则表达式过滤 +可以使用以下 URL query 过滤内容,支持正则 -`filter` 选出想要的内容 +filter 选出想要的内容 -- `filter`: 过滤标题和描述 +- filter: 过滤标题和描述 -- `filter_title`: 过滤标题 +- filter_title: 过滤标题 -- `filter_description`: 过滤描述 +- filter_description: 过滤描述 -- `filter_author`: 过滤作者 +- filter_author: 过滤作者 -- `filter_time`: 过滤时间,仅支持数字,单位为秒。返回指定时间范围内的内容。如果条目没有输出`pubDate`或者格式不正确将不会被过滤 +- filter_time: 过滤时间,仅支持数字,单位为秒。返回指定时间范围内的内容。如果条目没有输出`pubDate`或者格式不正确将不会被过滤 举例 1: `https://rsshub.app/bilibili/fav/2267573/801952073?filter=编曲|摄影` 举例 2: -`filterout` 去掉不要的内容 +filterout 去掉不要的内容 -- `filterout`: 过滤标题和描述 +- filterout: 过滤标题和描述 -- `filterout_title`: 过滤标题 +- filterout_title: 过滤标题 -- `filterout_description`: 过滤描述 +- filterout_description: 过滤描述 -- `filterout_author`: 过滤作者 +- filterout_author: 过滤作者 举例: `https://rsshub.app/bilibili/fav/2267573/801952073?filterout=编曲|摄影` `filter_case_sensitive` 过滤是否区分大小写,`filter` 和 `filterout`同时适用 -默认为 `true`,区分大小写 +默认为 true,区分大小写 举例 1: @@ -65,7 +65,7 @@ Telegram 即时预览模式需要在官网制作页面处理模板,请前往[官网](https://instantview.telegram.org/)了解更多 -- `tgiv`: 模板 hash,可从模板制作页面分享出来的链接末尾获取(`&rhash=`后面跟着的字符串) +- tgiv: 模板 hash,可从模板制作页面分享出来的链接末尾获取(`&rhash=`后面跟着的字符串) 举例: @@ -73,13 +73,13 @@ Telegram 即时预览模式需要在官网制作页面处理模板,请前往[ 可以输出 Sci-hub 链接,用于知名期刊或输出 DOI 的科学期刊类 RSS。 -- `scihub`: 任意值开启 +- scihub: 任意值开启 举例: ## 中文简繁体转换 -- `opencc`: `s2t` 简体转繁体、`t2s` 繁体转简体,其它可选值见 [simple-wasm - Configurations](https://github.com/fengkx/simplecc-wasm#%E9%85%8D%E7%BD%AE-configurations) +- opencc: s2t 简体转繁体、t2s 繁体转简体,其它可选值见 [simple-wasm - Configurations](https://github.com/fengkx/simplecc-wasm#%E9%85%8D%E7%BD%AE-configurations) 举例: diff --git a/docs/picture.md b/docs/picture.md index 892533bdef3285..bcc7e00689bcf7 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -475,13 +475,9 @@ R18 显示 ## 国家地理 -### 每日精选 - - - ### 每日一图 - + ## 煎蛋 diff --git a/docs/program-update.md b/docs/program-update.md index 5e796f71f32077..3be81420650643 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -318,12 +318,6 @@ pageClass: routes 见 [#nintendo](/game.html#nintendo) -## NPM - -### 包 - - - ## Nvidia Web Driver ### 更新日志 @@ -388,7 +382,7 @@ pageClass: routes ### 版本更新 - + ## RescueTime @@ -508,12 +502,6 @@ pageClass: routes 见 [#怪物猎人世界](/game.html#guai-wu-lie-ren-shi-jie) -## 华硕 - -### 固件 - - - ## 蒲公英应用分发 ### app 更新 diff --git a/docs/programming.md b/docs/programming.md index 36de6faaeff0dc..c4671fea64f365 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -84,11 +84,11 @@ Rated 对象 ### Commits - + ### Tags - + ## Bitmovin @@ -252,7 +252,7 @@ GitHub 官方也提供了一些 RSS: ### 搜索结果 - + | 排序选项 | sort | | ------------ | --------- | @@ -261,8 +261,6 @@ GitHub 官方也提供了一些 RSS: | 根据 fork 数量排序 | forks | | 根据更新时间排序 | updated | - - ### 用户 Star 的仓库 @@ -503,58 +501,6 @@ GitHub 官方也提供了一些 RSS: -## Quicker - -### 动作分享 - - - -| 动作库最新更新 | 动作库最多赞 | 动作库新动作 | 动作库最近赞 | -| ------- | ----------- | ---------- | ----------- | -| Recent | Recommended | NewActions | RecentLiked | - -| 子程序 | 扩展热键 | 文本指令 | -| ----------- | --------- | ------------ | -| SubPrograms | PowerKeys | TextCommands | - - - -### 讨论区 - - - -分类 - -| 使用问题 | 动作开发 | BUG 反馈 | 功能建议 | -| ---- | ---- | ------ | ---- | -| 1 | 9 | 3 | 4 | - -| 动作需求 | 经验创意 | 动作推荐 | 信息发布 | -| ---- | ---- | ---- | ---- | -| 6 | 2 | 7 | 5 | - -| 随便聊聊 | 异常报告 | 全部 | -| ---- | ---- | --- | -| 8 | 10 | all | - -状态 - -| 全部 | 精华 | 已归档 | -| -- | ------ | ------- | -| | digest | achived | - - - -### 用户更新 - - - -| 动作 | 子程序 | 动作单 | -| ------- | ----------- | ----------- | -| Actions | SubPrograms | ActionLists | - - - ## react ### react-native @@ -1060,16 +1006,6 @@ GitHub 官方也提供了一些 RSS: -## 政采云前端技术团队 - -### 博客 - - - -### 小报 - - - ## 知晓程序 ### 文章 diff --git a/docs/reading.md b/docs/reading.md index 147e4afdcaf3fb..ebbbd0683e60e3 100644 --- a/docs/reading.md +++ b/docs/reading.md @@ -10,26 +10,6 @@ pageClass: routes -## hameln - -### 章节更新 - - - -举例网址: - - - -## kakuyomu - -### 章节更新 - - - -举例网址: - - - ## Kindle Unlimited ### 会员限时免费读书单 diff --git a/docs/social-media.md b/docs/social-media.md index 8bdd4078f904b7..01358d6d672d46 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -1171,34 +1171,25 @@ rule ## 微博 -::: warning 注意 - -微博会针对请求的来源地区返回不同的结果。\ -一个已知的例子为:部分视频因未知原因仅限中国大陆境内访问 (CDN 域名为 `locallimit.us.sinaimg.cn` 而非 `f.video.weibocdn.com`)。若一条微博含有这种视频且 RSSHub 实例部署在境外,抓取到的微博可能不含视频。将 RSSHub 部署在境内有助于抓取这种视频,但阅读器也必须处于境内网络环境以加载视频。 - -::: - 对于微博内容,在 `routeParams` 参数中以 query string 格式指定选项,可以控制输出的样式 -| 键 | 含义 | 接受的值 | 默认值 | -| -------------------------- | ----------------------------------------- | -------------- | ------------------------------- | -| readable | 是否开启细节排版可读性优化 | 0/1/true/false | false | -| authorNameBold | 是否加粗作者名字 | 0/1/true/false | false | -| showAuthorInTitle | 是否在标题处显示作者 | 0/1/true/false | false(`/weibo/keyword/`中为 true) | -| showAuthorInDesc | 是否在正文处显示作者 | 0/1/true/false | false(`/weibo/keyword/`中为 true) | -| showAuthorAvatarInDesc | 是否在正文处显示作者头像(若阅读器会提取正文图片,不建议开启) | 0/1/true/false | false | -| showEmojiForRetweet | 显示 “🔁” 取代 “转发” 两个字 | 0/1/true/false | false | -| showRetweetTextInTitle | 在标题出显示转发评论(置为 false 则在标题只显示被转发微博) | 0/1/true/false | true | -| addLinkForPics | 为图片添加可点击的链接 | 0/1/true/false | false | -| showTimestampInDescription | 在正文处显示被转发微博的时间戳 | 0/1/true/false | false | -| widthOfPics | 微博配图宽(生效取决于阅读器) | 不指定 / 数字 | 不指定 | -| heightOfPics | 微博配图高(生效取决于阅读器) | 不指定 / 数字 | 不指定 | -| sizeOfAuthorAvatar | 作者头像大小 | 数字 | 48 | -| displayVideo | 是否直接显示微博视频和 Live Photo,只在博主或个人时间线 RSS 中有效 | 0/1/true/false | true | -| displayArticle | 是否直接显示微博文章,只在博主或个人时间线 RSS 中有效 | 0/1/true/false | false | -| displayComments | 是否直接显示热门评论,只在博主或个人时间线 RSS 中有效 | 0/1/true/false | false | -| showEmojiInDescription | 是否展示正文中的微博表情,关闭则替换为 `[表情名]` | 0/1/true/false | true | -| showLinkIconInDescription | 是否展示正文中的链接图标 | 0/1/true/false | true | +| 键 | 含义 | 接受的值 | 默认值 | +| -------------------------- | --------------------------------- | -------------- | ------------------------------- | +| readable | 是否开启细节排版可读性优化 | 0/1/true/false | false | +| authorNameBold | 是否加粗作者名字 | 0/1/true/false | false | +| showAuthorInTitle | 是否在标题处显示作者 | 0/1/true/false | false(`/weibo/keyword/`中为 true) | +| showAuthorInDesc | 是否在正文处显示作者 | 0/1/true/false | false(`/weibo/keyword/`中为 true) | +| showAuthorAvatarInDesc | 是否在正文处显示作者头像(若阅读器会提取正文图片,不建议开启) | 0/1/true/false | false | +| showEmojiForRetweet | 显示 “🔁” 取代 “转发” 两个字 | 0/1/true/false | false | +| showRetweetTextInTitle | 在标题出显示转发评论(置为 false 则在标题只显示被转发微博) | 0/1/true/false | true | +| addLinkForPics | 为图片添加可点击的链接 | 0/1/true/false | false | +| showTimestampInDescription | 在正文处显示被转发微博的时间戳 | 0/1/true/false | false | +| widthOfPics | 微博配图宽(生效取决于阅读器) | 不指定 / 数字 | 不指定 | +| heightOfPics | 微博配图高(生效取决于阅读器) | 不指定 / 数字 | 不指定 | +| sizeOfAuthorAvatar | 作者头像大小 | 数字 | 48 | +| displayVideo | 是否直接显示微博视频,只在博主或个人时间线 RSS 中有效 | 0/1/true/false | true | +| displayArticle | 是否直接显示微博文章,只在博主或个人时间线 RSS 中有效 | 0/1/true/false | false | +| showEmojiInDescription | 是否展示正文中的 emoji 表情 | 0/1/true/false | true | 指定更多与默认值不同的参数选项可以改善 RSS 的可读性,如 @@ -1210,7 +1201,7 @@ rule ### 博主 - + 部分博主仅登录可见,不支持订阅,可以通过打开 `https://m.weibo.cn/u/:uid` 验证 @@ -1239,7 +1230,7 @@ rule ### 个人时间线 - + ::: warning 注意 diff --git a/docs/traditional-media.md b/docs/traditional-media.md index d72e092766ab1b..c24304002489b6 100644 --- a/docs/traditional-media.md +++ b/docs/traditional-media.md @@ -827,16 +827,6 @@ Type 栏目: -## 共同网 - -### 最新报道 - - - -`keyword` 为关键词,由于共同网有许多关键词并不在主页列出,此处不一一列举,可从关键词页的 URL 的最后一级路径中提取。如 `日中关系` 的关键词页 URL 为 `https://china.kyodonews.net/news/japan-china_relationship`, 则将 `japan-china_relationship` 填入 `keyword`。特别地,当填入 `rss` 时,将从共同网官方 RSS 中抓取文章;略去时,将从首页抓取最新报道 (注意:首页更新可能比官方 RSS 稍慢)。 - - - ## 国际金融报栏目 ### 栏目 @@ -847,65 +837,6 @@ Type 栏目: -## 衡阳全搜索 - -### 衡阳日报 - - - -| 版 | 编号 | -| ----------- | -- | -| 全部 | | -| 第 A01 版:版面一 | 1 | -| 第 A02 版:版面二 | 2 | -| 第 A03 版:版面三 | 3 | -| 第 A04 版:版面四 | 4 | -| 第 A05 版:版面五 | 5 | -| 第 A06 版:版面六 | 6 | -| 第 A07 版:版面七 | 7 | -| 第 A08 版:版面八 | 8 | - - - -### 衡阳晚报 - - - -| 版 | 编号 | -| ----------- | -- | -| 全部 | | -| 第 A01 版:版面一 | 1 | -| 第 A02 版:版面二 | 2 | -| 第 A03 版:版面三 | 3 | -| 第 A04 版:版面四 | 4 | -| 第 A05 版:版面五 | 5 | -| 第 A06 版:版面六 | 6 | -| 第 A07 版:版面七 | 7 | -| 第 A08 版:版面八 | 8 | - - - -## 湖南日报 - -### 电子刊物 - - - -| 版 | 编号 | -| ------------ | -- | -| 全部 | | -| 第 01 版:头版 | 1 | -| 第 02 版:要闻 | 2 | -| 第 03 版:要闻 | 3 | -| 第 04 版:深度 | 4 | -| 第 05 版:市州 | 5 | -| 第 06 版:理论・学习 | 6 | -| 第 07 版:观察 | 7 | -| 第 08 版:时事 | 8 | -| 第 09 版:中缝 | 9 | - - - ## 华尔街见闻 ### 华尔街见闻 @@ -1255,7 +1186,7 @@ category 对应的关键词有 ### 频道 - + | 视频 | 时事 | 财经 | 思想 | 澎湃号 | 生活 | | ----- | ----- | ----- | ----- | ----- | ----- | @@ -1267,10 +1198,6 @@ category 对应的关键词有 -### 明查 - - - ### 澎湃美数组作品集 diff --git a/docs/travel.md b/docs/travel.md index 5908301a75fd70..971acca47c5d9e 100644 --- a/docs/travel.md +++ b/docs/travel.md @@ -92,7 +92,7 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运 ### 分类 - + ## 活动行 @@ -114,38 +114,6 @@ IATA 国际航空运输协会机场代码,参见[维基百科 国际航空运 -## 纽约布鲁克林博物馆 - - - -## 纽约大都会美术馆 - - - -## 纽约古根海姆基金会 - - - -## 纽约新美术馆 - - - -## 纽约犹太人博物馆 - - - -## 芝加哥当代艺术博物馆 - - - ## 中国美术馆 ### 美术馆新闻 diff --git a/lib/config.js b/lib/config.js index 0ecdd68a2146e0..cd01465518659d 100644 --- a/lib/config.js +++ b/lib/config.js @@ -149,10 +149,6 @@ const calculateValue = () => { google: { fontsApiKey: envs.GOOGLE_FONTS_API_KEY, }, - hefeng: { - // weather - key: envs.HEFENG_KEY, - }, infzm: { cookie: envs.INFZM_COOKIE, }, diff --git a/lib/middleware/cache/index.js b/lib/middleware/cache/index.js index 05bf29a2e853a5..178f700d650081 100644 --- a/lib/middleware/cache/index.js +++ b/lib/middleware/cache/index.js @@ -27,10 +27,10 @@ if (config.cache.type === 'redis') { globalCache.set = cacheModule.set; } else if (config.cache.type === 'memory') { cacheModule = require('./memory'); - const { memoryCache } = cacheModule.clients; + const { pageCache } = cacheModule.clients; globalCache.get = (key) => { if (key && cacheModule.status.available) { - return memoryCache.get(key, { updateAgeOnGet: false }); + return pageCache.get(key); } }; globalCache.set = (key, value, maxAge) => { @@ -41,7 +41,7 @@ if (config.cache.type === 'redis') { value = JSON.stringify(value); } if (key) { - return memoryCache.set(key, value, { ttl: maxAge * 1000 }); + return pageCache.set(key, value, { ttl: maxAge * 1000 }); } }; } else { diff --git a/lib/middleware/cache/memory.js b/lib/middleware/cache/memory.js index 671ac3cf134675..1e7efe3a6cc86e 100644 --- a/lib/middleware/cache/memory.js +++ b/lib/middleware/cache/memory.js @@ -3,24 +3,30 @@ const config = require('@/config').value; const status = { available: false }; -const memoryCache = new Lru({ +const pageCache = new Lru({ ttl: config.cache.routeExpire * 1000, max: config.memory.max, }); +const routeCache = new Lru({ + ttl: config.cache.routeExpire * 1000, + max: config.memory.max, + updateAgeOnGet: true, +}); + status.available = true; module.exports = { get: (key, refresh = true) => { if (key && status.available) { - let value = memoryCache.get(key, { updateAgeOnGet: refresh }); + let value = (refresh ? routeCache : pageCache).get(key); if (value) { value = value + ''; } return value; } }, - set: (key, value, maxAge = config.cache.contentExpire) => { + set: (key, value, maxAge = config.cache.contentExpire, refresh = true) => { if (!value || value === 'undefined') { value = ''; } @@ -28,9 +34,9 @@ module.exports = { value = JSON.stringify(value); } if (key && status.available) { - return memoryCache.set(key, value, { ttl: maxAge * 1000 }); + return (refresh ? routeCache : pageCache).set(key, value, { ttl: maxAge * 1000 }); } }, - clients: { memoryCache }, + clients: { pageCache, routeCache }, status, }; diff --git a/lib/middleware/template.js b/lib/middleware/template.js index 88dfc57961e2bd..8598fe5a1253a1 100644 --- a/lib/middleware/template.js +++ b/lib/middleware/template.js @@ -2,7 +2,7 @@ const art = require('art-template'); const path = require('path'); const config = require('@/config').value; const typeRegex = /\.(atom|rss|debug\.json)$/; -const { collapseWhitespace, convertDateToISO8601 } = require('@/utils/common-utils'); +const { collapseWhitespace } = require('@/utils/common-utils'); module.exports = async (ctx, next) => { if (ctx.headers['user-agent'] && ctx.headers['user-agent'].includes('Reeder')) { @@ -28,8 +28,7 @@ module.exports = async (ctx, next) => { if (!ctx.body) { let template; - const outputType = ctx.state.type[1]; - switch (outputType) { + switch (ctx.state.type[1]) { case 'atom': template = path.resolve(__dirname, '../views/atom.art'); break; @@ -67,11 +66,6 @@ module.exports = async (ctx, next) => { item.itunes_duration = Math.floor(item.itunes_duration / 3600) + ':' + (Math.floor((item.itunes_duration % 3600) / 60) / 100).toFixed(2).slice(-2) + ':' + (((item.itunes_duration % 3600) % 60) / 100).toFixed(2).slice(-2); } - - if (outputType === 'atom') { - item.pubDate = convertDateToISO8601(item.pubDate); - item.updated = convertDateToISO8601(item.updated); - } }); } diff --git a/lib/router.js b/lib/router.js index ae3caefb7bd754..14036b2bff2e7e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -25,10 +25,10 @@ const lazyloadRouteHandler = (routeHandlerPath) => (ctx) => { router.get('/1draw', lazyloadRouteHandler('./routes/1draw/index')); // quicker -// router.get('/quicker/qa', lazyloadRouteHandler('./routes/quicker/qa.js')); -// router.get('/quicker/update', lazyloadRouteHandler('./routes/quicker/update.js')); -// router.get('/quicker/user/action/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js')); -// router.get('/quicker/user/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js')); +router.get('/quicker/qa', lazyloadRouteHandler('./routes/quicker/qa.js')); +router.get('/quicker/update', lazyloadRouteHandler('./routes/quicker/update.js')); +router.get('/quicker/user/action/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js')); +router.get('/quicker/user/:uid/:person', lazyloadRouteHandler('./routes/quicker/person.js')); // Benedict Evans router.get('/benedictevans', lazyloadRouteHandler('./routes/benedictevans/recent.js')); @@ -301,10 +301,9 @@ router.get('/t66y/:id/:type?', lazyloadRouteHandler('./routes/t66y/index')); // 色中色 router.get('/sexinsex/:id/:type?', lazyloadRouteHandler('./routes/sexinsex/index')); -// 国家地理 migrated to v2 -// router.get('/natgeo/dailyselection', lazyloadRouteHandler('./routes/natgeo/dailyselection')); -// router.get('/natgeo/dailyphoto', lazyloadRouteHandler('./routes/natgeo/dailyphoto')); -// router.get('/natgeo/:cat/:type?', lazyloadRouteHandler('./routes/natgeo/natgeo')); +// 国家地理 +router.get('/natgeo/dailyphoto', lazyloadRouteHandler('./routes/natgeo/dailyphoto')); +router.get('/natgeo/:cat/:type?', lazyloadRouteHandler('./routes/natgeo/natgeo')); // 一个 router.get('/one', lazyloadRouteHandler('./routes/one/index')); @@ -849,13 +848,13 @@ router.get('/xclient/app/:name', lazyloadRouteHandler('./routes/xclient/app')); router.get('/embassy/:country/:city?', lazyloadRouteHandler('./routes/embassy/index')); // 澎湃新闻 -// router.get('/thepaper/featured', lazyloadRouteHandler('./routes/thepaper/featured')); -// router.get('/thepaper/channel/:id', lazyloadRouteHandler('./routes/thepaper/channel')); -// router.get('/thepaper/list/:id', lazyloadRouteHandler('./routes/thepaper/list')); +router.get('/thepaper/featured', lazyloadRouteHandler('./routes/thepaper/featured')); +router.get('/thepaper/channel/:id', lazyloadRouteHandler('./routes/thepaper/channel')); +router.get('/thepaper/list/:id', lazyloadRouteHandler('./routes/thepaper/list')); // 澎湃美数课 -// router.get('/thepaper/839studio', lazyloadRouteHandler('./routes/thepaper/839studio/studio.js')); -// router.get('/thepaper/839studio/:id', lazyloadRouteHandler('./routes/thepaper/839studio/category.js')); +router.get('/thepaper/839studio', lazyloadRouteHandler('./routes/thepaper/839studio/studio.js')); +router.get('/thepaper/839studio/:id', lazyloadRouteHandler('./routes/thepaper/839studio/category.js')); // 电影首发站 router.get('/dysfz', lazyloadRouteHandler('./routes/dysfz/index')); @@ -1265,9 +1264,9 @@ router.get('/xiaoheihe/discount/:platform?', lazyloadRouteHandler('./routes/xiao // 惠誉评级 router.get('/fitchratings/site/:type', lazyloadRouteHandler('./routes/fitchratings/site')); -// 移动支付 migrated to v2 -// router.get('/mpaypass/news', lazyloadRouteHandler('./routes/mpaypass/news')); -// router.get('/mpaypass/main/:type?', lazyloadRouteHandler('./routes/mpaypass/main')); +// 移动支付 +router.get('/mpaypass/news', lazyloadRouteHandler('./routes/mpaypass/news')); +router.get('/mpaypass/main/:type?', lazyloadRouteHandler('./routes/mpaypass/main')); // 新浪科技探索 router.get('/sina/discovery/:type', lazyloadRouteHandler('./routes/sina/discovery')); @@ -1333,10 +1332,10 @@ router.get('/leetcode/submission/us/:user', lazyloadRouteHandler('./routes/leetc router.get('/leetcode/submission/cn/:user', lazyloadRouteHandler('./routes/leetcode/check-cn')); // 虎扑 -// router.get('/hupu/bxj/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs')); -// router.get('/hupu/bbs/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs')); -// router.get('/hupu/all/:caty', lazyloadRouteHandler('./routes/hupu/all')); -// router.get('/hupu/dept/:dept', lazyloadRouteHandler('./routes/hupu/dept')); +router.get('/hupu/bxj/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs')); +router.get('/hupu/bbs/:id/:order?', lazyloadRouteHandler('./routes/hupu/bbs')); +router.get('/hupu/all/:caty', lazyloadRouteHandler('./routes/hupu/all')); +router.get('/hupu/dept/:dept', lazyloadRouteHandler('./routes/hupu/dept')); // 牛客网 migrated to v2 // router.get('/nowcoder/discuss/:type/:order', lazyloadRouteHandler('./routes/nowcoder/discuss')); @@ -2182,7 +2181,7 @@ router.get('/kaggle/competitions/:category?', lazyloadRouteHandler('./routes/kag router.get('/kaggle/user/:user', lazyloadRouteHandler('./routes/kaggle/user')); // PubMed Trending -// router.get('/pubmed/trending', lazyloadRouteHandler('./routes/pubmed/trending')); +router.get('/pubmed/trending', lazyloadRouteHandler('./routes/pubmed/trending')); // 领科 (linkresearcher.com) router.get('/linkresearcher/:params', lazyloadRouteHandler('./routes/linkresearcher/index')); diff --git a/lib/routes/amd/graphicsdrivers.js b/lib/routes/amd/graphicsdrivers.js index 268b019b8a2113..5adbe36cb2c545 100644 --- a/lib/routes/amd/graphicsdrivers.js +++ b/lib/routes/amd/graphicsdrivers.js @@ -27,7 +27,7 @@ module.exports = async (ctx) => { if (!data) { const res = await got.get(url); data = res.data; - ctx.cache.set(url, data, config.cache.contentExpire); + ctx.cache.set(url, data, config.cache.contentExpire, false); } const $ = cheerio.load(data, { xmlMode: true }); diff --git a/lib/routes/hupu/all.js b/lib/routes/hupu/all.js new file mode 100644 index 00000000000000..ccf27265db4a1a --- /dev/null +++ b/lib/routes/hupu/all.js @@ -0,0 +1,53 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const rootUrl = 'https://bbs.hupu.com'; + const currentUrl = `${rootUrl}/all-${ctx.params.caty}`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + const $ = cheerio.load(response.data); + + const list = $('div.list ul li') + .slice(0, 20) + .map((_, item) => { + item = $(item); + const a = item.find('span.textSpan a[title]'); + return { + title: a.attr('title'), + link: `${rootUrl}${a.attr('href')}`, + }; + }) + .get(); + + const items = await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + try { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + + item.description = content('div.quote-content').html(); + item.author = content('div.author div.left a.u').eq(0).text(); + item.pubDate = new Date(content('span.stime').eq(0).text() + ' GMT+8').toUTCString(); + + return item; + } catch (error) { + return Promise.resolve(''); + } + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +}; diff --git a/lib/routes/hupu/bbs.js b/lib/routes/hupu/bbs.js new file mode 100644 index 00000000000000..11767c942312b5 --- /dev/null +++ b/lib/routes/hupu/bbs.js @@ -0,0 +1,83 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const url = require('url'); + +const host = 'https://bbs.hupu.com'; + +module.exports = async (ctx) => { + const id = ctx.params.id; + const order = ctx.params.order || 1; + + let link = `https://bbs.hupu.com/${id}`; + + let order_name; + if (parseInt(order) === 1) { + order_name = '最新回帖'; + } else if (parseInt(order) === 2) { + order_name = '最新发帖'; + link += '-postdate-1'; + } else if (parseInt(order) === 3) { + order_name = '精华'; + link += '-digest'; + } + + const response = await got.get(link); + const $ = cheerio.load(response.data); + + const type_name = $('span.infoname').text(); + const description = $('#des_forum').text(); + + const list = $('ul.for-list li') + .slice(0, 10) + .map(function () { + const info = { + title: $(this).find('div.titlelink.box > a.truetit').text().trim(), + link: $(this).find('div.titlelink.box > a.truetit').attr('href'), + author: $(this).find('a.aulink').text(), + }; + return info; + }) + .get(); + + for (let i = list.length - 1; i >= 0; i--) { + if (!list[i].link.endsWith('html')) { + list.splice(i, 1); + } + } + + const out = await Promise.all( + list.map(async (info) => { + const title = info.title; + const itemUrl = url.resolve(host, info.link); + const author = info.author; + + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const response = await got.get(itemUrl); + const $ = cheerio.load(response.data); + + const date = $('#tpc span.stime').text(); + const description = $('div.quote-content').html(); + + const single = { + title, + link: itemUrl, + author, + description, + pubDate: new Date(date).toUTCString(), + }; + ctx.cache.set(itemUrl, JSON.stringify(single)); + return Promise.resolve(single); + }) + ); + + ctx.state.data = { + title: `${type_name}${order_name}——虎扑步行街`, + link, + description, + item: out, + }; +}; diff --git a/lib/routes/hupu/dept.js b/lib/routes/hupu/dept.js new file mode 100644 index 00000000000000..8dc8f9e6e74e2b --- /dev/null +++ b/lib/routes/hupu/dept.js @@ -0,0 +1,66 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + let currentUrl = ''; + if (ctx.params.dept === 'soccer-china') { + currentUrl = `https://soccer.hupu.com/china`; + } else { + currentUrl = `https://${ctx.params.dept}.hupu.com`; + } + + const response = await got({ + method: 'get', + url: currentUrl, + }); + const $ = cheerio.load(response.data); + + const query = { + nba: 'div.list-item', + soccer: 'div.list-item', + 'soccer-china': '#focusNews', + cba: '#focusNews', + gg: 'div.fouce-news', + }; + + const list = $(query[ctx.params.dept]) + .find('a[href!=""]') + .slice(0, 20) + .map((_, item) => { + item = $(item); + + return { + title: item.text(), + link: item.attr('href'), + }; + }) + .get(); + + const items = await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + try { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + + item.description = content('div.quote-content').html(); + item.author = content('div.author div.left a.u').eq(0).text(); + item.pubDate = new Date(content('span.stime').eq(0).text() + ' GMT+8').toUTCString(); + + return item; + } catch (error) { + return Promise.resolve(''); + } + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +}; diff --git a/lib/v2/mpaypass/main.js b/lib/routes/mpaypass/main.js similarity index 52% rename from lib/v2/mpaypass/main.js rename to lib/routes/mpaypass/main.js index 7d337de39d772e..8673b7bb80d46b 100644 --- a/lib/v2/mpaypass/main.js +++ b/lib/routes/mpaypass/main.js @@ -1,7 +1,5 @@ -const got = require('@/utils/got'); +const got = require('../../utils/got'); const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); -const timezone = require('@/utils/timezone'); module.exports = async (ctx) => { let title_url = ''; @@ -31,34 +29,40 @@ module.exports = async (ctx) => { .map(function () { const info = { title: $(this).find('#title').text(), - link: $(this).find('#title').find('a').attr('href'), + link: $(this).find('#pic a').attr('href'), + pic: $(this).find('#pic img').attr('src'), time: $(this).find('#time').text(), - category: $(this) - .find('#keywords') - .find('a') - .toArray() - .map((e) => $(e).text().trim()), }; return info; }) .get(); const out = await Promise.all( - list.map((info) => - ctx.cache.tryGet(info.link, async () => { - const response = await got(info.link); - const $ = cheerio.load(response.data); - const newsbody = $('div.newsbody').html(); + list.map(async (info) => { + const title = info.title; + let date = info.time.toString(); + date = date.substring(2, date.length); + const link = info.link; - return { - title: info.title, - link: info.link, - pubDate: timezone(parseDate(info.time), +8), - description: newsbody, - category: info.category, - }; - }) - ) + const cache = await ctx.cache.get(link); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const response = await got.get(link); + const $ = cheerio.load(response.data); + const newsbody = $('div.newsbody').html(); + + const single = { + title, + link, + pubDate: date, + description: newsbody, + }; + + ctx.cache.set(link, JSON.stringify(single)); + return Promise.resolve(single); + }) ); ctx.state.data = { diff --git a/lib/routes/mpaypass/news.js b/lib/routes/mpaypass/news.js new file mode 100644 index 00000000000000..49defa6e6e2d8c --- /dev/null +++ b/lib/routes/mpaypass/news.js @@ -0,0 +1,43 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const link = `http://m.mpaypass.com.cn/`; + const listData = await got.get(link); + const $list = cheerio.load(listData.data); + ctx.state.data = { + title: `新闻 - 移动支付网`, + link, + item: await Promise.all( + $list('.newsbodylist') + .map(async (_, el) => { + const $el = $list(el); + const $a = $el.find('.newsbodylist-title a'); + const href = $a.attr('href'); + const title = $a.text(); + const date = $el.find('.newsbodylist-title span').text().split('|')[1]; + + const key = href; + let description; + const value = await ctx.cache.get(key); + + if (value) { + description = value; + } else { + const contentData = await got.get(href); + const $content = cheerio.load(contentData.data); + description = $content('.newsbody').html(); + ctx.cache.set(key, description); + } + + return { + title, + description, + link: href, + pubDate: new Date(date).toUTCString(), + }; + }) + .get() + ), + }; +}; diff --git a/lib/routes/natgeo/dailyphoto.js b/lib/routes/natgeo/dailyphoto.js new file mode 100644 index 00000000000000..8e6c1695d931c2 --- /dev/null +++ b/lib/routes/natgeo/dailyphoto.js @@ -0,0 +1,27 @@ +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const today = new Date(); + const year = today.getFullYear(); + const month = today.getMonth() + 1; + + const api = `https://www.nationalgeographic.com/content/photography/en_US/photo-of-the-day/_jcr_content/.gallery.${year}-${month}.json`; + const response = await got.get(api); + const items = response.data.items; + + const out = items.slice(0, 10).map((item) => { + const info = { + title: item.image.title, + author: item.image.credit && item.image.credit.replace('Photograph by ', ''), + link: item.pageUrl, + description: `` + item.image.caption, + }; + return info; + }); + + ctx.state.data = { + title: 'Photo of the Day', + link: 'https://www.nationalgeographic.com/photography/photo-of-the-day/', + item: out, + }; +}; diff --git a/lib/v2/natgeo/natgeo.js b/lib/routes/natgeo/natgeo.js similarity index 53% rename from lib/v2/natgeo/natgeo.js rename to lib/routes/natgeo/natgeo.js index 14133197a8dae5..42458cb16b99e9 100644 --- a/lib/v2/natgeo/natgeo.js +++ b/lib/routes/natgeo/natgeo.js @@ -1,51 +1,65 @@ const cheerio = require('cheerio'); const got = require('@/utils/got'); -const { parseDate } = require('@/utils/parse-date'); // https://www.natgeomedia.com//article/ +const MonthMap = { + JAN: 0, + FEB: 1, + MAR: 2, + APR: 3, + MAY: 4, + JUN: 5, + JUL: 6, + AUG: 7, + SEP: 8, + OCT: 9, + NOV: 10, + DEC: 11, +}; + async function load(link) { - const { data } = await got(link); + const { data } = await got.get(link); const $ = cheerio.load(data); const dtStr = $('.content-title-area') .find('h6') .first() - .html() - .replace(/ /gi, ' ') - .trim(); - + .text() + .split(/[\s.]+/); + const dt = new Date(); + dt.setMonth(MonthMap[dtStr[0].toUpperCase()]); + dt.setDate(dtStr[1]); let description = $('article').first().html() + $('article').eq(1).html(); if (/photo/.test(link)) { description = $('#content-album').html() + description; } return { title: $('title').text(), - pubDate: parseDate(dtStr, 'MMM. DD YYYY'), + pubDate: dt.toUTCString(), description, }; } module.exports = async (ctx) => { - const type = ctx.params.type ?? ''; + const type = ctx.params.type || ''; const url = `https://www.natgeomedia.com/${ctx.params.cat}/${type}`; - const res = await got(url); + const res = await got.get(url); const $ = cheerio.load(res.data); - const urlList = $('.article-link-w100') - .find('.read-btn') - .toArray() - .map((i) => ({ - link: $(i).find('a[href]').first().attr('href'), - })); + const urlList = Array.prototype.map.call($('.article-link-w100').find('.read-btn'), (i) => $(i).find('a[href]').first().attr('href')); + const count = []; + for (let i = 0; i < Math.min(urlList.length, 10); i++) { + count.push(i); + } const out = await Promise.all( - urlList.map(async (i) => { - const link = i.link; + count.map(async (i) => { + const link = urlList[i]; const single = { link, }; const other = await ctx.cache.tryGet(link, () => load(link)); - return { ...single, ...other }; + return Object.assign({}, single, other); }) ); ctx.state.data = { diff --git a/lib/routes/pubmed/trending.js b/lib/routes/pubmed/trending.js new file mode 100644 index 00000000000000..7307ac95e86033 --- /dev/null +++ b/lib/routes/pubmed/trending.js @@ -0,0 +1,65 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const url = require('url'); +const date = require('@/utils/date'); + +const base = 'https://pubmed.ncbi.nlm.nih.gov'; + +module.exports = async (ctx) => { + const link = `${base}/trending/`; + const response = await got.get(encodeURI(link)); + const pageCapture = cheerio.load(response.data); + + const list = pageCapture('.docsum-content') + .map((_, elem) => { + const $ = cheerio.load(elem); + const partial = $('a').attr('href'); + return { + title: $('a').text().trim(), + link: url.resolve(base, partial), + author: $('.full-authors').text(), + }; + }) + .get(); + + const out = await Promise.all( + list.map((item) => + ctx.cache.tryGet(item.link, async () => { + const detail = await got.get(item.link); + const detailCapture = cheerio.load(detail.data); + + item.doi = detailCapture('meta[name="citation_doi"]').attr('content'); + item.pubDate = date(detailCapture('meta[name="citation_date"]').attr('content')); + + let authorContents = ''; + if (item.author !== '') { + authorContents = ` +
+ ${item.author} +
+ `; + } + const abs = detailCapture('#enc-abstract').html(); + let absContents = ''; + if (abs !== null) { + absContents = ` +
+

Abstract

+

${abs}

+
+ `; + } + item.description = authorContents + absContents; + + return item; + }) + ) + ); + + ctx.state.data = { + title: 'PubMed | Trending Articles', + description: 'Trending Articles from PubMed Website', + link, + item: out, + }; +}; diff --git a/lib/routes/quicker/person.js b/lib/routes/quicker/person.js new file mode 100644 index 00000000000000..03ce82096a5fa9 --- /dev/null +++ b/lib/routes/quicker/person.js @@ -0,0 +1,32 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const person = ctx.params.person; + const uid = ctx.params.uid; + const response = await got({ + method: 'get', + url: `https://getquicker.net/User/${uid}/${person}`, + }); + const data = response.data; + const $ = cheerio.load(data); + const list = $('.align-middle:nth-child(2) a:nth-child(1)'); + + const out = list + .map((index, item) => { + item = $(item); + return { + title: item.text(), + description: item.next().text(), + guid: item.text(), + link: item.attr('href'), + }; + }) + .get(); + + ctx.state.data = { + title: '用户动作 - Quicker', + link: 'https://getquicker.net/Help/Versions', + item: out, + }; +}; diff --git a/lib/routes/quicker/qa.js b/lib/routes/quicker/qa.js new file mode 100644 index 00000000000000..183f902d6dde04 --- /dev/null +++ b/lib/routes/quicker/qa.js @@ -0,0 +1,41 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: 'https://getquicker.net/QA', + }); + const data = response.data; + const $ = cheerio.load(data); + const list = $('div.question-title > a'); + + const out = await Promise.all( + list + .map(async (index, item) => { + item = $(item); + const response_item = await got({ + method: 'get', + url: 'https://getquicker.net' + item.attr('href'), + }); + const a = cheerio.load(response_item.data); + return Promise.resolve({ + title: item.text(), + description: `作者:${a('.user-link').first().text()}
描述:${a('.user-content').first().html()}`, + pubDate: + a('.user-content span') + .last() + .text() + .match(/最后更新于\s*\S+/) || '1900/1/1', + link: item.attr('href'), + }); + }) + .get() + ); + + ctx.state.data = { + title: '讨论区 - Quicker', + link: 'https://getquicker.net/QA', + item: out, + }; +}; diff --git a/lib/routes/quicker/update.js b/lib/routes/quicker/update.js new file mode 100644 index 00000000000000..e47b382e69a7f5 --- /dev/null +++ b/lib/routes/quicker/update.js @@ -0,0 +1,30 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: 'https://getquicker.net/Help/Versions', + }); + const data = response.data; + const $ = cheerio.load(data); + const list = $('div.version-list > div'); + + const out = list + .map((index, item) => { + item = $(item); + return { + title: item.find('h2 > a').text(), + description: item.find('div.article-content').html(), + pubDate: item.find('div > span.text-secondary.d-lg-block.mb-2').text() || '1900/1/1', + link: item.find('h2 > a').attr('href'), + }; + }) + .get(); + + ctx.state.data = { + title: '版本更新 - Quicker', + link: 'https://getquicker.net/Help/Versions', + item: out, + }; +}; diff --git a/lib/v2/thepaper/839studio/category.js b/lib/routes/thepaper/839studio/category.js similarity index 100% rename from lib/v2/thepaper/839studio/category.js rename to lib/routes/thepaper/839studio/category.js diff --git a/lib/v2/thepaper/839studio/studio.js b/lib/routes/thepaper/839studio/studio.js similarity index 100% rename from lib/v2/thepaper/839studio/studio.js rename to lib/routes/thepaper/839studio/studio.js diff --git a/lib/v2/thepaper/channel.js b/lib/routes/thepaper/channel.js similarity index 100% rename from lib/v2/thepaper/channel.js rename to lib/routes/thepaper/channel.js diff --git a/lib/v2/thepaper/featured.js b/lib/routes/thepaper/featured.js similarity index 100% rename from lib/v2/thepaper/featured.js rename to lib/routes/thepaper/featured.js diff --git a/lib/v2/thepaper/list.js b/lib/routes/thepaper/list.js similarity index 100% rename from lib/v2/thepaper/list.js rename to lib/routes/thepaper/list.js diff --git a/lib/routes/thepaper/utils.js b/lib/routes/thepaper/utils.js new file mode 100644 index 00000000000000..772f1ae6b46877 --- /dev/null +++ b/lib/routes/thepaper/utils.js @@ -0,0 +1,48 @@ +const cheerio = require('cheerio'); +const date = require('@/utils/date'); +const got = require('@/utils/got'); + +module.exports = { + ProcessFeed: async (query, link, ctx) => { + const res = await got.get(link); + + const $ = cheerio.load(res.data); + const list = $(query).slice(0, 10).get(); + + return Promise.all( + list.map(async (item) => { + const $ = cheerio.load(item); + const itemUrl = `https://m.thepaper.cn/${$(item).find('a').eq(0).attr('href')}`; + const cache = await ctx.cache.get(itemUrl); + if (cache) { + return Promise.resolve(JSON.parse(cache)); + } + + const res = await got.get(itemUrl); + const content = cheerio.load(res.data); + + let description, pubDate; + + if (content('div.news_video_msg').length > 0) { + description = content('#vdetail_sum').html(); + pubDate = content('div.news_video_msg').html().split('  ')[0]; + } else if (content('#slider_wrapper_ul').length > 0) { + description = ''; + pubDate = new Date(date($(item).find('div.list_item_extra span').eq(1).text())).toUTCString(); + } else { + description = content('div.newsdetail_content').html(); + pubDate = new Date(content('div.date').text().trim().split('来源:')[0].trim() + ' GMT+8').toUTCString(); + } + + const single = { + title: content('title').text(), + link: itemUrl, + description, + pubDate, + author: content('div.author').text(), + }; + return Promise.resolve(single); + }) + ); + }, +}; diff --git a/lib/routes/weibo/keyword.js b/lib/routes/weibo/keyword.js index 5afe45481547e5..ea9ed473deb1bf 100644 --- a/lib/routes/weibo/keyword.js +++ b/lib/routes/weibo/keyword.js @@ -3,29 +3,21 @@ const got = require('@/utils/got'); const weiboUtils = require('./utils'); const timezone = require('@/utils/timezone'); const { fallback, queryToBoolean } = require('@/utils/readable-social'); -const config = require('@/config').value; module.exports = async (ctx) => { const keyword = ctx.params.keyword; - const data = await ctx.cache.tryGet( - `weibo:keyword:${keyword}`, - async () => { - const _r = await got({ - method: 'get', - url: `https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D61%26q%3D${encodeURIComponent(keyword)}%26t%3D0`, - headers: { - Referer: `https://m.weibo.cn/p/searchall?containerid=100103type%3D1%26q%3D${encodeURIComponent(keyword)}`, - 'MWeibo-Pwa': 1, - 'X-Requested-With': 'XMLHttpRequest', - 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - }, - }); - return _r.data.data.cards; + const response = await got({ + method: 'get', + url: `https://m.weibo.cn/api/container/getIndex?containerid=100103type%3D61%26q%3D${encodeURIComponent(keyword)}%26t%3D0`, + headers: { + Referer: `https://m.weibo.cn/p/searchall?containerid=100103type%3D1%26q%3D${encodeURIComponent(keyword)}`, + 'MWeibo-Pwa': 1, + 'X-Requested-With': 'XMLHttpRequest', + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', }, - config.cache.routeExpire, - false - ); + }); + const data = response.data.data.cards; const routeParams = querystring.parse(ctx.params.routeParams); ctx.state.data = { diff --git a/lib/routes/weibo/super_index.js b/lib/routes/weibo/super_index.js index cd8a7e715b9aee..914ee2e08381ad 100644 --- a/lib/routes/weibo/super_index.js +++ b/lib/routes/weibo/super_index.js @@ -2,37 +2,28 @@ const got = require('@/utils/got'); const weiboUtils = require('./utils'); const timezone = require('@/utils/timezone'); const queryString = require('query-string'); -const config = require('@/config').value; module.exports = async (ctx) => { const id = ctx.params.id; const type = ctx.params.type ?? 'feed'; - const containerData = await ctx.cache.tryGet( - `weibo:super_index:container:${id}:${type}`, - async () => { - const _r = await got('https://m.weibo.cn/api/container/getIndex', { - searchParams: queryString.stringify({ - containerid: `${id}_-_${type}`, - luicode: '10000011', - lfid: `${id}_-_main`, - }), - headers: { - Referer: `https://m.weibo.cn/p/index?containerid=${id}_-_soul&luicode=10000011&lfid=${id}_-_main`, - 'MWeibo-Pwa': '1', - 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - 'X-Requested-With': 'XMLHttpRequest', - }, - }); - return _r.data.data; + const res = await got.get('https://m.weibo.cn/api/container/getIndex', { + searchParams: queryString.stringify({ + containerid: `${id}_-_${type}`, + luicode: '10000011', + lfid: `${id}_-_main`, + }), + headers: { + Referer: `https://m.weibo.cn/p/index?containerid=${id}_-_soul&luicode=10000011&lfid=${id}_-_main`, + 'MWeibo-Pwa': '1', + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', + 'X-Requested-With': 'XMLHttpRequest', }, - config.cache.routeExpire, - false - ); + }); const resultItems = []; - for (const card of containerData.cards) { + for (const card of res.data.data.cards) { if (!('card_group' in card)) { continue; } @@ -54,9 +45,9 @@ module.exports = async (ctx) => { } ctx.state.data = { - title: `微博超话 - ${containerData.pageInfo.page_title}`, + title: `微博超话 - ${res.data.data.pageInfo.page_title}`, link: `https://weibo.com/p/${id}/super_index`, - description: `#${containerData.pageInfo.page_title}# 的超话`, + description: `#${res.data.data.pageInfo.page_title}# 的超话`, item: resultItems, }; }; diff --git a/lib/routes/weibo/timeline.js b/lib/routes/weibo/timeline.js index c99a44015dbdeb..13866f12f9bb0e 100644 --- a/lib/routes/weibo/timeline.js +++ b/lib/routes/weibo/timeline.js @@ -12,7 +12,6 @@ module.exports = async (ctx) => { const token = await ctx.cache.get('weibotimelineuid' + uid, false); let displayVideo = '1'; let displayArticle = '0'; - let displayComments = '0'; if (routeParams) { if (routeParams === '1' || routeParams === '0') { displayVideo = routeParams; @@ -20,41 +19,24 @@ module.exports = async (ctx) => { const routeParams = querystring.parse(ctx.params.routeParams); displayVideo = fallback(undefined, queryToBoolean(routeParams.displayVideo), true) ? '1' : '0'; displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false) ? '1' : '0'; - displayComments = fallback(undefined, queryToBoolean(routeParams.displayComments), false) ? '1' : '0'; } } if (token) { - const userInfo = await ctx.cache.tryGet( - `weibo:timeline:userInfo:${uid}`, - async () => { - const _r = await got({ - method: 'get', - url: `https://m.weibo.cn/api/container/getIndex?type=uid&value=${uid}`, - headers: { - Referer: 'https://m.weibo.cn/', - }, - }); - return _r.data.data.userInfo; + const containerResponse = await got({ + method: 'get', + url: `https://m.weibo.cn/api/container/getIndex?type=uid&value=${uid}`, + headers: { + Referer: 'https://m.weibo.cn/', }, - config.cache.routeExpire, - false - ); - const name = userInfo.screen_name; - const description = userInfo.description; - const profileImageUrl = userInfo.profile_image_url; + }); + const name = containerResponse.data.data.userInfo.screen_name; + const description = containerResponse.data.data.userInfo.description; + const profileImageUrl = containerResponse.data.data.userInfo.profile_image_url; - const response = await ctx.cache.tryGet( - `weibo:timeline:${uid}`, - async () => { - const _r = await got(`https://api.weibo.com/2/statuses/home_timeline.json?access_token=${token}&count=100&feature=${feature}`); - return _r.data; - }, - config.cache.routeExpire, - false - ); + const response = await got.get(`https://api.weibo.com/2/statuses/home_timeline.json?access_token=${token}&count=100&feature=${feature}`); // 检查token失效 - if (response.error !== undefined) { + if (response.data.error !== undefined) { const { app_key = '', redirect_url = ctx.request.origin + '/weibo/timeline/0' } = config.weibo; ctx.status = 302; @@ -64,7 +46,7 @@ module.exports = async (ctx) => { ctx.redirect(`https://api.weibo.com/oauth2/authorize?client_id=${app_key}&redirect_uri=${redirect_url}${routeParams ? `&state=${routeParams}` : ''}`); } const resultItem = await Promise.all( - response.statuses.map(async (item) => { + response.data.statuses.map(async (item) => { const key = `weibotimelineurl${item.user.id}${item.id}`; const value = await ctx.cache.tryGet(key, async () => { const _data = await weiboUtils.getShowData(uid, item.id); @@ -81,7 +63,7 @@ module.exports = async (ctx) => { // 转发的长微博处理 const retweet = item.retweeted_status; if (retweet?.isLongText) { - const retweetData = await ctx.cache.tryGet(`weibo:retweeted:${retweet.user.id}:${retweet.id}`, () => weiboUtils.getShowData(retweet.user.id, retweet.id)); + const retweetData = await weiboUtils.getShowData(retweet.user.id, retweet.id); if (retweetData?.text) { item.retweeted_status.text = retweetData.text; } @@ -104,11 +86,6 @@ module.exports = async (ctx) => { } } - // 评论的处理 - if (displayComments === '1') { - description = await weiboUtils.formatComments(ctx, description, item); - } - // 文章的处理 if (displayArticle === '1') { // 含被转发微博时需要从被转发微博中获取文章 @@ -146,7 +123,7 @@ module.exports = async (ctx) => { const token = rep.data.access_token; const uid = rep.data.uid; const expires_in = rep.data.expires_in; - await ctx.cache.set('weibotimelineuid' + uid, token, expires_in); + await ctx.cache.set('weibotimelineuid' + uid, token, expires_in, false); ctx.set({ 'Content-Type': 'text/html; charset=UTF-8', diff --git a/lib/routes/weibo/user.js b/lib/routes/weibo/user.js index 587df0d9607252..b0557914f08714 100644 --- a/lib/routes/weibo/user.js +++ b/lib/routes/weibo/user.js @@ -1,7 +1,6 @@ const querystring = require('querystring'); const got = require('@/utils/got'); const weiboUtils = require('./utils'); -const config = require('@/config').value; const timezone = require('@/utils/timezone'); const { parseDate } = require('@/utils/parse-date'); const { fallback, queryToBoolean } = require('@/utils/readable-social'); @@ -10,7 +9,6 @@ module.exports = async (ctx) => { const uid = ctx.params.uid; let displayVideo = '1'; let displayArticle = '0'; - let displayComments = '0'; if (ctx.params.routeParams) { if (ctx.params.routeParams === '1' || ctx.params.routeParams === '0') { displayVideo = ctx.params.routeParams; @@ -18,54 +16,35 @@ module.exports = async (ctx) => { const routeParams = querystring.parse(ctx.params.routeParams); displayVideo = fallback(undefined, queryToBoolean(routeParams.displayVideo), true) ? '1' : '0'; displayArticle = fallback(undefined, queryToBoolean(routeParams.displayArticle), false) ? '1' : '0'; - displayComments = fallback(undefined, queryToBoolean(routeParams.displayComments), false) ? '1' : '0'; } } - const containerData = await ctx.cache.tryGet( - `weibo:user:index:${uid}`, - async () => { - const _r = await got({ - method: 'get', - url: `https://m.weibo.cn/api/container/getIndex?type=uid&value=${uid}`, - headers: { - Referer: `https://m.weibo.cn/u/${uid}`, - 'MWeibo-Pwa': 1, - 'X-Requested-With': 'XMLHttpRequest', - }, - }); - return _r.data; + const { data: containerData } = await got({ + method: 'get', + url: `https://m.weibo.cn/profile/info?uid=${uid}`, + headers: { + Referer: 'https://m.weibo.cn/', }, - config.cache.routeExpire, - false - ); - const name = containerData.data.userInfo.screen_name; - const description = containerData.data.userInfo.description; - const profileImageUrl = containerData.data.userInfo.profile_image_url; - const containerId = containerData.data.tabsInfo.tabs.filter((item) => item.tab_type === 'weibo')[0].containerid; - - const cards = await ctx.cache.tryGet( - `weibo:user:cards:${uid}:${containerId}`, - async () => { - const _r = await got({ - method: 'get', - url: `https://m.weibo.cn/api/container/getIndex?type=uid&value=${uid}&containerid=${containerId}`, - headers: { - Referer: `https://m.weibo.cn/u/${uid}`, - 'MWeibo-Pwa': 1, - 'X-Requested-With': 'XMLHttpRequest', - }, - }); - return _r.data.data.cards; + }); + const name = containerData.data.user.screen_name; + const description = containerData.data.user.description; + const profileImageUrl = containerData.data.user.profile_image_url; + const containerid = containerData.data.more.match(/\d+/)[0]; + + const response = await got({ + method: 'get', + url: `https://m.weibo.cn/api/container/getIndex?containerid=${containerid}`, + headers: { + Referer: `https://m.weibo.cn/u/${uid}`, + 'MWeibo-Pwa': 1, + 'X-Requested-With': 'XMLHttpRequest', }, - config.cache.routeExpire, - false - ); + }); let earliestDate; const resultItem = await Promise.all( - cards + response.data.data.cards .reverse() // reverse first to ensure the pinned card will be processed lastly .map(async (item) => { if (!item.mblog && item.card_group && Array.isArray(item.card_group) && item.card_group.length > 0) { @@ -106,7 +85,7 @@ module.exports = async (ctx) => { // 转发的长微博处理 const retweet = item.mblog.retweeted_status; if (retweet && retweet.isLongText) { - const retweetData = await ctx.cache.tryGet(`weibo:retweeted:${retweet.user.id}:${retweet.bid}`, () => weiboUtils.getShowData(retweet.user.id, retweet.bid)); + const retweetData = await weiboUtils.getShowData(retweet.user.id, retweet.bid); if (retweetData !== undefined && retweetData.text) { item.mblog.retweeted_status.text = retweetData.text; } @@ -128,11 +107,6 @@ module.exports = async (ctx) => { } } - // 评论的处理 - if (displayComments === '1') { - description = await weiboUtils.formatComments(ctx, description, item.mblog); - } - // 文章的处理 if (displayArticle === '1') { // 含被转发微博时需要从被转发微博中获取文章 diff --git a/lib/routes/weibo/utils.js b/lib/routes/weibo/utils.js index 7870805c0a7bfd..604b724e2280c4 100644 --- a/lib/routes/weibo/utils.js +++ b/lib/routes/weibo/utils.js @@ -24,7 +24,6 @@ const weiboUtils = { heightOfPics: fallback(params.heightOfPics, queryToInteger(routeParams.heightOfPics), -1), sizeOfAuthorAvatar: fallback(params.sizeOfAuthorAvatar, queryToInteger(routeParams.sizeOfAuthorAvatar), 48), showEmojiInDescription: fallback(params.showEmojiInDescription, queryToInteger(routeParams.showEmojiInDescription), true), - showLinkIconInDescription: fallback(params.showLinkIconInDescription, queryToInteger(routeParams.showLinkIconInDescription), true), }; params = mergedParams; @@ -45,7 +44,6 @@ const weiboUtils = { heightOfPics, sizeOfAuthorAvatar, showEmojiInDescription, - showLinkIconInDescription, } = params; let retweeted = ''; @@ -55,14 +53,10 @@ const weiboUtils = { if (!showEmojiInDescription) { htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/]*?alt=["']?([^>]+?)["']?\s[^>]*?\/><\/span>/g, '$1'); } - // 去掉链接的图标,保留 a 标签链接 - if (!showLinkIconInDescription) { - htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/(]*>)]*><\/span>[^<>]*?([^<>]*?)<\/span><\/a>/g, '$1$2'); - } - // 去掉乱七八糟的图标 // 不需要,上述的替换应该已经把所有的图标都替换掉了,且这条 regex 会破坏上述替换不发生时的输出 + // 去掉外部链接的图标,保留 a 标签链接 // 不能去掉,否则像超话这样的有意义的图标也会被去掉 + // htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/(]*>)]*><\/span>[^<>]*?([^<>]*?)<\/span><\/a>/g, '$1$2'); + // 去掉乱七八糟的图标 // 不能去掉,否则像超话这样的有意义的图标也会被去掉 // htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/(]*?>)<\/span>/g, ''); - // 将行内图标的高度设置为一行,改善阅读体验。但有些阅读器删除了 style 属性,无法生效 // 不需要,微博已经作此设置 - // htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/(?<=)/g, '
'); htmlNewLineUnreplaced = htmlNewLineUnreplaced.replace(/全文<\/a>/g, ''); @@ -106,12 +100,8 @@ const weiboUtils = { } } - // drop live photo - const livePhotoCount = status.pics ? status.pics.filter((pic) => pic.type === 'livephotos').length : 0; - const pics = status.pics && status.pics.filter((pic) => pic.type !== 'livephotos'); - // 添加微博配图 - if (pics) { + if (status.pics) { if (readable) { html += '
'; } @@ -119,12 +109,12 @@ const weiboUtils = { // 一些RSS Reader会识别所有标签作为内含图片显示,我们不想要头像也作为内含图片之一 // 让所有配图在description的最前面再次出现一次,但宽高设为0 let picsPrefix = ''; - pics.forEach((item) => { + status.pics.forEach((item) => { picsPrefix += ``; }); picsPrefixes.push(picsPrefix); - pics.forEach((item) => { + status.pics.forEach((item) => { if (addLinkForPics) { html += '
'; } @@ -205,8 +195,7 @@ const weiboUtils = { .replace(/(]*?>)<\/span>/g, '') // 去掉所有图标 .replace(//g, '[图片]') .replace(/<.*?>/g, '') - .replace('\n', '') - .trim(); + .replace('\n', ''); } if (status.retweeted_status) { title += showEmojiForRetweet ? '🔁 ' : ' - 转发 '; @@ -215,15 +204,7 @@ const weiboUtils = { .replace(/(]*?>)<\/span>/g, '') // 去掉所有图标 .replace(//g, '[图片]') .replace(/<.*?>/g, '') - .replace('\n', '') - .trim(); - } - if (livePhotoCount > 0) { - title += ' '; - title += new Array(livePhotoCount + 1).join('[Live Photo]'); - } - if (status.page_info && status.page_info === 'video') { - title += ' [视频]'; + .replace('\n', ''); } return { description: html, title }; @@ -242,15 +223,6 @@ const weiboUtils = { }, formatVideo: (itemDesc, status) => { const pageInfo = status.page_info; - const livePhotos = status.pics && status.pics.filter((pic) => pic.type === 'livephotos' && pic.videoSrc); - let video = '
'; - let anyVideo = false; - if (livePhotos) { - livePhotos.forEach((livePhoto) => { - video += ``; - anyVideo = true; - }); - } if (pageInfo && pageInfo.type === 'video') { const pagePic = pageInfo.page_pic; const posterUrl = pagePic ? pagePic.url : ''; @@ -266,6 +238,7 @@ const weiboUtils = { const hasVideo = video720p || videoHd || videoHdHevc || videoLd; if (hasVideo) { + let video = '
'; video += `

视频无法显示,请前往微博视频观看。

`; } video += ''; - anyVideo = true; + itemDesc += video; } } - if (anyVideo) { - itemDesc += video; - } return itemDesc; }, formatArticle: async (ctx, itemDesc, status) => { @@ -378,45 +348,6 @@ const weiboUtils = { } return itemDesc; }, - formatComments: async (ctx, itemDesc, status) => { - if (status && status.comments_count && status.id && status.mid) { - const id = status.id; - const mid = status.mid; - const link = `https://m.weibo.cn/comments/hotflow?id=${id}&mid=${mid}&max_id_type=0`; - const response = await ctx.cache.tryGet(link, async () => { - const _response = await got.get(link, { - headers: { - Referer: `https://m.weibo.cn/detail/${id}`, - 'MWeibo-Pwa': 1, - 'X-Requested-With': 'XMLHttpRequest', - 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1', - }, - }); - return _response.data; - }); - if (response.data && response.data.data) { - const comments = response.data.data; - itemDesc += `
`; - itemDesc += '

热门评论

'; - comments.forEach((comment) => { - itemDesc += '

'; - itemDesc += `${comment.user.screen_name}: ${comment.text}`; - if (comment.comments) { - itemDesc += '

'; - comment.comments.forEach((comment) => { - itemDesc += '
'; - itemDesc += `${comment.user.screen_name}: ${comment.text}`; - itemDesc += '
'; - }); - itemDesc += '
'; - } - itemDesc += '

'; - }); - itemDesc += '
'; - } - } - return itemDesc; - }, }; module.exports = weiboUtils; diff --git a/lib/utils/common-utils.js b/lib/utils/common-utils.js index 4e29e5086046ab..882cccd7c08d2e 100644 --- a/lib/utils/common-utils.js +++ b/lib/utils/common-utils.js @@ -1,5 +1,3 @@ -const { parseDate } = require('@/utils/parse-date'); - // convert a string into title case const toTitleCase = (str) => str @@ -19,19 +17,7 @@ const collapseWhitespace = (str) => { return str; }; -const convertDateToISO8601 = (date) => { - if (!date) { - return date; - } - if (typeof date !== 'object') { - // some routes may call `.toUTCString()` before passing the date to ctx... - date = parseDate(date); - } - return date.toISOString(); -}; - module.exports = { toTitleCase, collapseWhitespace, - convertDateToISO8601, }; diff --git a/lib/utils/parse-date.js b/lib/utils/parse-date.js index e729752c4f8ef7..183cff0b5ef7aa 100644 --- a/lib/utils/parse-date.js +++ b/lib/utils/parse-date.js @@ -1,196 +1,42 @@ const dayjs = require('dayjs'); dayjs.extend(require('dayjs/plugin/customParseFormat')); -dayjs.extend(require('dayjs/plugin/duration')); -dayjs.extend(require('dayjs/plugin/weekday')); - -const words = [ - { - startAt: dayjs(), - regExp: /^(?:今(?:天|日)|t(?:o)?da(?:y)?)(.*)/, - }, - { - startAt: dayjs().subtract(1, 'days'), - regExp: /^(?:昨(?:天|日)|y(?:ester)?da(?:y)?)(.*)/, - }, - { - startAt: dayjs().subtract(2, 'days'), - regExp: /^(?:前天|(?:the)?d(?:ay)?b(?:eforeyesterda)?y)(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(1)) ? dayjs().weekday(1).subtract(1, 'week') : dayjs().weekday(1), - regExp: /^(?:周|星期)一(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(2)) ? dayjs().weekday(2).subtract(1, 'week') : dayjs().weekday(2), - regExp: /^(?:周|星期)二(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(3)) ? dayjs().weekday(3).subtract(1, 'week') : dayjs().weekday(3), - regExp: /^(?:周|星期)三(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(4)) ? dayjs().weekday(4).subtract(1, 'week') : dayjs().weekday(4), - regExp: /^(?:周|星期)四(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(5)) ? dayjs().weekday(5).subtract(1, 'week') : dayjs().weekday(5), - regExp: /^(?:周|星期)五(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(6)) ? dayjs().weekday(6).subtract(1, 'week') : dayjs().weekday(6), - regExp: /^(?:周|星期)六(.*)/, - }, - { - startAt: dayjs().isBefore(dayjs().weekday(7)) ? dayjs().weekday(7).subtract(1, 'week') : dayjs().weekday(7), - regExp: /^(?:周|星期)(?:日|天)(.*)/, - }, - { - startAt: dayjs().add(1, 'days'), - regExp: /^(?:明(?:天|日)|y(?:ester)?da(?:y)?)(.*)/, - }, - { - startAt: dayjs().add(2, 'days'), - regExp: /^(?:(?:后|後)(?:天|日)|(?:the)?d(?:ay)?a(?:fter)?t(?:omrrow)?)(.*)/, - }, -]; const patterns = [ { - unit: 'years', - regExp: /(\d+)(?:年|y(?:ea)?r(?:s)?)/, - }, - { - unit: 'months', - regExp: /(\d+)(?:(?:个|個)?月|month(?:s)?)/, + regexp: /^(\d+)分钟前$/, + handler: (minute) => dayjs().subtract(minute, 'minutes'), }, { - unit: 'weeks', - regExp: /(\d+)(?:周|(?:个|個)?星期|week(?:s)?)/, + regexp: /^(\d+)小时前$/, + handler: (hour) => dayjs().subtract(hour, 'hours'), }, { - unit: 'days', - regExp: /(\d+)(?:天|日|day(?:s)?)/, + regexp: /^(\d+)天前$/, + handler: (day) => dayjs().subtract(day, 'days'), }, { - unit: 'hours', - regExp: /(\d+)(?:(?:个|個)?(?:(?:小)?时|時|点|點)|h(?:ou)?r(?:s)?)/, + regexp: /^今天\s*((\d+:\d+)?)$/, + handler: (hm) => dayjs(hm || '0:0', ['HH:m', 'HH:mm', 'H:m', 'H:mm']), }, { - unit: 'minutes', - regExp: /(\d+)(?:分(?:钟|鐘)?|min(?:ute)?(?:s)?)/, + regexp: /^昨天\s*((\d+:\d+)?)$/, + handler: (hm) => dayjs(hm || '0:0', ['HH:m', 'HH:mm', 'H:m', 'H:mm']).subtract(1, 'day'), }, { - unit: 'seconds', - regExp: /(\d+)(?:秒(?:钟|鐘)?|sec(?:ond)?(?:s)?)/, + regexp: /^前天\s*((\d+:\d+)?)$/, + handler: (hm) => dayjs(hm || '0:0', ['HH:m', 'HH:mm', 'H:m', 'H:mm']).subtract(2, 'day'), }, ]; -const patternSize = Object.keys(patterns).length; - -/** - * 预处理日期字符串 - * @param {String} date 原始日期字符串 - */ -const toDate = (date) => - date - .toLowerCase() - .replace(/(^a(?:n)?\s)|(\sa(?:n)?\s)/g, '1') // 替换 `a` 和 `an` 为 `1` - .replace(/几|幾/g, '3') // 如 `几秒钟前` 视作 `3秒钟前` - .replace(/[\s,]/g, ''); // 移除所有空格 - -/** - * 将 `['\d+时', ..., '\d+秒']` 转换为 `{ hours: \d+, ..., seconds: \d+ }` - * 用于描述时间长度 - * @param {Array.} matches 所有匹配结果 - */ -const toDurations = (matches) => { - const durations = {}; - - let p = 0; - for (const m of matches) { - for (; p <= patternSize; p++) { - const match = patterns[p].regExp.exec(m); - if (match) { - durations[patterns[p].unit] = match[1]; - break; - } - } - } - return durations; -}; - module.exports = { parseDate: (date, ...options) => dayjs(date, ...options).toDate(), parseRelativeDate: (date) => { - // 预处理日期字符串 date - - const theDate = toDate(date); - - // 将 `\d+年\d+月...\d+秒前` 分割成 `['\d+年', ..., '\d+秒前']` - - const matches = theDate.match(/(?:\D+)?\d+(?!:|-|\/)\D+/g); - - if (matches) { - // 获得最后的时间单元,如 `\d+秒前` - - const lastMatch = matches.pop(); - - // 若最后的时间单元含有 `前`、`以前`、`之前` 等标识字段,减去相应的时间长度 - // 如 `1分10秒前` - - const beforeMatches = /(.*)(?:(?:之|以)?前|ago)$/.exec(lastMatch); - if (beforeMatches) { - matches.push(beforeMatches[1]); - return dayjs() - .subtract(dayjs.duration(toDurations(matches))) - .toDate(); - } - - // 若最后的时间单元含有 `后`、`以后`、`之后` 等标识字段,加上相应的时间长度 - // 如 `1分10秒后` - - const afterMatches = /(?:^in(.*)|(.*)(?:之|以)?(?:后|後))$/.exec(lastMatch); - if (afterMatches) { - matches.push(afterMatches[1] ?? afterMatches[2]); - return dayjs() - .add(dayjs.duration(toDurations(matches))) - .toDate(); - } - - // 以下处理日期字符串 date 含有特殊词的情形 - // 如 `今天1点10分` - - matches.push(lastMatch); - const firstMatch = matches.shift(); - - for (const w of words) { - const wordMatches = w.regExp.exec(firstMatch); - if (wordMatches) { - matches.unshift(wordMatches[1]); - - // 取特殊词对应日零时为起点,加上相应的时间长度 - - return w.startAt - .set('hour', 0) - .set('minute', 0) - .set('second', 0) - .set('millisecond', 0) - .add(dayjs.duration(toDurations(matches))) - .toDate(); - } - } - } else { - // 若日期字符串 date 不匹配 patterns 中所有模式,则默认为 `特殊词 + 标准时间格式` 的情形,此时直接将特殊词替换为对应日期 - // 如今天为 `2022-03-22`,则 `今天 20:00` => `2022-03-22 20:00` - - for (const w of words) { - const wordMatches = w.regExp.exec(theDate); - if (wordMatches) { - return dayjs(`${w.startAt.format('YYYY-MM-DD')} ${wordMatches[1]}`).toDate(); - } + for (const pattern of patterns) { + const match = pattern.regexp.exec(date); + if (match !== null) { + return pattern.handler(match[1]).toDate(); } } - - return date; + return null; }, }; diff --git a/lib/utils/torrent.js b/lib/utils/torrent.js index 099ebaa45d915f..a57562d6ddaa1d 100644 --- a/lib/utils/torrent.js +++ b/lib/utils/torrent.js @@ -60,7 +60,6 @@ class HDHome extends TorrentProvider { ); } } - TorrentSearchApi.loadProvider(HDHome); const allProviders = ['HDHome', 'Rarbg', '1337x', 'Yts', 'Eztv']; @@ -120,14 +119,7 @@ module.exports = { const keyword = keywords[0]; const normalizeKeyword = normalize(keyword); - let torrents; - try { - torrents = await TorrentSearchApi.search(providers, keywords.join(' '), category); - } catch (e) { - // expect a status code error, but we don't mind catching all errors here - // logger.debug(e); - return {}; - } + const torrents = await TorrentSearchApi.search(providers, keywords.join(' '), category); if (torrents && torrents.length > 0) { let bestRating = 0; let bestSize = 0; diff --git a/lib/v2/asus/bios.js b/lib/v2/asus/bios.js deleted file mode 100644 index bb343e55184163..00000000000000 --- a/lib/v2/asus/bios.js +++ /dev/null @@ -1,38 +0,0 @@ -const got = require('@/utils/got'); -const { parseDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); - -const getProductID = async (model) => { - const searchAPI = `https://odinapi.asus.com.cn/recent-data/apiv2/SearchSuggestion?SystemCode=asus&WebsiteCode=cn&SearchKey=${model}&SearchType=ProductsAll&RowLimit=4&sitelang=cn`; - const response = await got(searchAPI); - - return { - productID: response.data.Result[0].Content[0].DataId, - url: response.data.Result[0].Content[0].Url, - }; -}; - -module.exports = async (ctx) => { - const model = ctx.params.model; - const { productID, url } = await getProductID(model); - const biosAPI = `https://www.asus.com.cn/support/api/product.asmx/GetPDBIOS?website=cn&model=${model}&pdid=${productID}&sitelang=cn`; - - const response = await got(biosAPI); - const biosList = response.data.Result.Obj[0].Files; - - const items = biosList.map((item) => ({ - title: item.Title, - description: art(path.join(__dirname, 'templates/bios.art'), { - item, - }), - pubDate: parseDate(item.ReleaseDate, 'YYYY/MM/DD'), - link: url, - })); - - ctx.state.data = { - title: `${model} BIOS`, - link: url, - item: items, - }; -}; diff --git a/lib/v2/asus/maintainer.js b/lib/v2/asus/maintainer.js deleted file mode 100644 index 45440b15a762cf..00000000000000 --- a/lib/v2/asus/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/bios/:model': ['Fatpandac'], -}; diff --git a/lib/v2/asus/radar.js b/lib/v2/asus/radar.js deleted file mode 100644 index 636df00acde6b8..00000000000000 --- a/lib/v2/asus/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'asus.com.cn': { - _name: 'Asus 华硕', - '.': [ - { - title: '固件', - docs: 'https://docs.rsshub.app/program-update.html#hua-shuo', - source: ['/'], - target: '/bios/:model', - }, - ], - }, -}; diff --git a/lib/v2/asus/router.js b/lib/v2/asus/router.js deleted file mode 100644 index e95103000df735..00000000000000 --- a/lib/v2/asus/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/bios/:model', require('./bios')); -}; diff --git a/lib/v2/asus/templates/bios.art b/lib/v2/asus/templates/bios.art deleted file mode 100644 index 08bcee2ea332c9..00000000000000 --- a/lib/v2/asus/templates/bios.art +++ /dev/null @@ -1,6 +0,0 @@ -

更新信息:

-{{@ item.Description}} -

版本: {{item.Version}}

-

大小: {{item.FileSize}}

-

更新日期: {{item.ReleaseDate}}

-

下载链接: 中国下载 | 全球下载

diff --git a/lib/v2/bilibili/liveArea.js b/lib/v2/bilibili/liveArea.js index 303aa900e6ede1..eaf5c92e3c3d6f 100644 --- a/lib/v2/bilibili/liveArea.js +++ b/lib/v2/bilibili/liveArea.js @@ -34,8 +34,18 @@ module.exports = async (ctx) => { parentID = parentArea.id; areaTitle = area.name; // cateID = area.cate_id; - areaLink = `https://live.bilibili.com/p/eden/area-tags?parentAreaId=${parentID}&areaId=${areaID}`; - break; + switch (parentID) { + case 1: + areaLink = `https://live.bilibili.com/pages/area/ent-all#${area.cate_id}/${areaID}`; + break; + case 2: + case 3: + areaLink = `https://live.bilibili.com/p/eden/area-tags#/${parentID}/${areaID}`; + break; + case 4: + areaLink = 'https://live.bilibili.com/pages/area/draw'; + break; + } } } } diff --git a/lib/v2/brooklynmuseum/exhibitions.js b/lib/v2/brooklynmuseum/exhibitions.js deleted file mode 100644 index 2dfa5a9fd15dac..00000000000000 --- a/lib/v2/brooklynmuseum/exhibitions.js +++ /dev/null @@ -1,27 +0,0 @@ -const buildData = require('@/utils/common-config'); - -module.exports = async (ctx) => { - let link; - const state = ctx.params.state; - - switch (state) { - case undefined: - case 'current': - link = 'https://www.brooklynmuseum.org/exhibitions/'; - break; - default: - link = `https://www.brooklynmuseum.org/exhibitions/${state}`; - } - - ctx.state.data = await buildData({ - link, - url: link, - title: 'Brooklyn Museum - Exhibitions', - item: { - item: '.exhibitions .image-card', - title: `$('h2 > a, h3 > a').text()`, - link: `$('h2 > a, h3 > a').attr('href')`, - description: `$('h6').text()`, - }, - }); -}; diff --git a/lib/v2/brooklynmuseum/maintainer.js b/lib/v2/brooklynmuseum/maintainer.js deleted file mode 100644 index 2b582f7fce773b..00000000000000 --- a/lib/v2/brooklynmuseum/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/exhibitions': ['chazeon'], -}; diff --git a/lib/v2/brooklynmuseum/radar.js b/lib/v2/brooklynmuseum/radar.js deleted file mode 100644 index 7a518af6b297e9..00000000000000 --- a/lib/v2/brooklynmuseum/radar.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'brooklynmuseum.org': { - _name: 'Brooklyn Museum', - www: [ - { - title: 'Exhibitions', - docs: 'https://docs.rsshub.app/en/travel.html#brooklyn-museum', - }, - ], - }, -}; diff --git a/lib/v2/brooklynmuseum/router.js b/lib/v2/brooklynmuseum/router.js deleted file mode 100644 index 3b6bc4063e9c62..00000000000000 --- a/lib/v2/brooklynmuseum/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/exhibitions/:state?', require('./exhibitions')); -}; diff --git a/lib/v2/douban/people/status.js b/lib/v2/douban/people/status.js index 8d47b154a21eb2..244158c390d88d 100644 --- a/lib/v2/douban/people/status.js +++ b/lib/v2/douban/people/status.js @@ -1,7 +1,6 @@ const querystring = require('querystring'); const got = require('@/utils/got'); const { fallback, queryToBoolean, queryToInteger } = require('@/utils/readable-social'); -const config = require('@/config').value; const headers = { Referer: `https://m.douban.com/` }; @@ -467,15 +466,8 @@ async function getFullTextItems(ctx, items) { module.exports = async (ctx) => { const userid = ctx.params.userid; const url = `https://m.douban.com/rexxar/api/v2/status/user_timeline/${userid}`; - const items = await ctx.cache.tryGet( - url, - async () => { - const _r = await got({ url, headers }); - return _r.data.items; - }, - config.cache.routeExpire, - false - ); + const response = await got({ url, headers }); + const items = response.data.items; if (items) { await getFullTextItems(ctx, items); diff --git a/lib/v2/douban/people/wish.js b/lib/v2/douban/people/wish.js index 42a71fbfdefb17..15e33a2265a2aa 100644 --- a/lib/v2/douban/people/wish.js +++ b/lib/v2/douban/people/wish.js @@ -13,8 +13,6 @@ module.exports = async (ctx) => { const torrentMinRating = routeParams.torrentMinRating ? parseFloat(routeParams.torrentMinRating) : 0.5; const torrentSkipNoMatch = routeParams.torrentSkipNoMatch === 'true'; - let userName; - const pageSize = 15; const pagesCount = routeParams.pagesCount ? parseInt(routeParams.pagesCount) : 1; const tasks = []; @@ -22,61 +20,51 @@ module.exports = async (ctx) => { const url = `https://movie.douban.com/people/${userid}/wish?start=${page * pageSize}`; tasks.push( - ctx.cache - .tryGet( - url, - async () => { - const _r = await got({ - method: 'GET', - url, - headers: { - Referer: url, - Cookie: config.douban.cookie || '', - }, - }); - return _r.data; - }, - config.cache.routeExpire, - false - ) - .then((data) => { - const $ = cheerio.load(data); - const list = $('div.article > div.grid-view > div.item'); - userName = userName || $('div.side-info-txt > h3').text(); + got({ + method: 'GET', + url, + headers: { + Referer: url, + Cookie: config.douban.cookie || '', + }, + }).then((response) => { + const data = response.data; + const $ = cheerio.load(data); + const list = $('div.article > div.grid-view > div.item'); - if (list) { - return Promise.all( - list.get().map(async (item) => { - item = $(item); - const itemPicUrl = item.find('.pic a img').attr('src'); - const info = item.find('.info'); - const title = info.find('ul li.title a').text(); - const url = info.find('ul li.title a').attr('href'); - const titles = title.split('/').filter((title) => title.trim()); - const day = info.find('ul li .date').text().trim(); - const rssItem = { - title: titles[0], - description: `${info.find('.intro').text()}
`, - link: url, - pubDate: new Date(day), - }; + if (list) { + return Promise.all( + list.get().map(async (item) => { + item = $(item); + const itemPicUrl = item.find('.pic a img').attr('src'); + const info = item.find('.info'); + const title = info.find('ul li.title a').text(); + const url = info.find('ul li.title a').attr('href'); + const titles = title.split('/').filter((title) => title.trim()); + const day = info.find('ul li .date').text().trim(); + const rssItem = { + title: titles[0], + description: `${info.find('.intro').text()}
`, + link: url, + pubDate: new Date(day), + }; - if (routeParams.torrentProvider) { - const category = url.indexOf('movie.douban.com') > 0 ? 'Movies' : 'TV'; - const keyword = titles.length > 1 ? titles[1] : titles[0]; - let keywords = [keyword]; - if (routeParams.torrentQuery) { - keywords = keywords.concat(routeParams.torrentQuery.split(',')); - } - const result = await torrent.get(providers, routeParams, keywords, category, torrentMinSeeds, torrentMinRating); - return Object.assign(rssItem, result); - } else { - return rssItem; + if (routeParams.torrentProvider) { + const category = url.indexOf('movie.douban.com') > 0 ? 'Movies' : 'TV'; + const keyword = titles.length > 1 ? titles[1] : titles[0]; + let keywords = [keyword]; + if (routeParams.torrentQuery) { + keywords = keywords.concat(routeParams.torrentQuery.split(',')); } - }) - ); - } - }) + const result = await torrent.get(providers, routeParams, keywords, category, torrentMinSeeds, torrentMinRating); + return Object.assign(rssItem, result); + } else { + return rssItem; + } + }) + ); + } + }) ); } @@ -85,7 +73,7 @@ module.exports = async (ctx) => { items = items.filter((item) => item.enclosure_url && item.enclosure_url.length > 0); } ctx.state.data = { - title: `豆瓣想看 - ${userName || userid}`, + title: `豆瓣想看 - ${userid}`, link: `https://movie.douban.com/people/${userid}/wish`, item: items, }; diff --git a/lib/v2/fortunechina/index.js b/lib/v2/fortunechina/index.js index 38577c1b0bc659..d7e1f6a0fe61a7 100644 --- a/lib/v2/fortunechina/index.js +++ b/lib/v2/fortunechina/index.js @@ -41,9 +41,9 @@ module.exports = async (ctx) => { const content = cheerio.load(detailResponse.data); const spans = content('.mod-info span').text(); - let matches = spans.match(/(\d{4}-\d{2}-\d{2})/); + let matches = spans.match(/(\d{4}年\d{2}月\d{2}日)/); if (matches) { - item.pubDate = parseDate(matches[1]); + item.pubDate = parseDate(matches[1].replace(/年|月/g, '-').replace(/日/, '')); } else { matches = spans.match(/(\d+小时前)/); if (matches) { @@ -53,7 +53,7 @@ module.exports = async (ctx) => { item.author = content('.name').text(); - content('.mod-info, .title, .eval-zan, .eval-pic, .sae-more').remove(); + content('.mod-info, .title').remove(); item.description = content('#articleContent, .eval-desc').html(); diff --git a/lib/v2/gov/anhui/kjt.js b/lib/v2/gov/anhui/kjt.js deleted file mode 100644 index 23ba94ce94882a..00000000000000 --- a/lib/v2/gov/anhui/kjt.js +++ /dev/null @@ -1,56 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const params = ctx.params[0] ?? 'kjzx/tzgg'; - - const rootUrl = 'http://kjt.ah.gov.cn'; - const currentUrl = `${rootUrl}/${params}/index.html`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - let items = $('.doc_list li') - .not('.columnName') - .find('a') - .toArray() - .map((item) => { - item = $(item); - - return { - title: item.text(), - link: item.attr('href'), - }; - }); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - item.description = content('.wzcon').html(); - item.author = content('meta[name="Author"]').attr('content'); - item.pubDate = timezone(parseDate(content('meta[name="PubDate"]').attr('content')), +8); - - return item; - }) - ) - ); - - ctx.state.data = { - title: $('title').text(), - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/gov/maintainer.js b/lib/v2/gov/maintainer.js index d74140d0d49aa5..ba7147a0988b9f 100644 --- a/lib/v2/gov/maintainer.js +++ b/lib/v2/gov/maintainer.js @@ -1,5 +1,4 @@ module.exports = { - '/anhui/kjt/:path?': ['nczitzk'], '/beijing/kw/:channel': ['Fatpandac'], '/shenzhen/hrss/szksy/:caty/:page?': ['zlasd'], '/shenzhen/zzb/:caty/:page?': ['zlasd'], @@ -8,7 +7,7 @@ module.exports = { '/guangdong/tqyb/tfxtq': ['Fatpandac'], '/guangdong/tqyb/sncsyjxh': ['Fatpandac'], '/huizhou/zwgk/:category?': ['Fatpandac'], - '/sichuan/deyang/govpulicinfo/:countyName': ['zytomorrow'], + '/sichuan/deyang/govpulicinfo/:countyName/:institutionName?': ['zytomorrow'], '/mfa/wjdt/:category?': ['nczitzk'], '/miit/wjfb/:ministry': ['Fatpandac'], '/miit/yjzj': ['Fatpandac'], diff --git a/lib/v2/gov/radar.js b/lib/v2/gov/radar.js index 89a973afed7c76..d3c3ec4075ec80 100644 --- a/lib/v2/gov/radar.js +++ b/lib/v2/gov/radar.js @@ -1,21 +1,4 @@ module.exports = { - 'ah.gov.cn': { - _name: '安徽省科技厅', - kjt: [ - { - title: '科技资讯', - docs: 'https://docs.rsshub.app/government.html#an-hui-sheng-ke-ji-ting-ke-ji-zi-xun', - source: ['/*'], - target: (params, url) => `/gov/anhui/kjt${new URL(url).href.match(/kjt\.ah\.gov\.cn(.*)\/index.html/)[1] ?? ''}`, - }, - { - title: '科技资源', - docs: 'https://docs.rsshub.app/government.html#an-hui-sheng-ke-ji-ting-ke-ji-zi-yuan', - source: ['/*'], - target: (params, url) => `/gov/anhui/kjt${new URL(url).href.match(/kjt\.ah\.gov\.cn(.*)\/index.html/)[1] ?? ''}`, - }, - ], - }, 'beijing.gov.cn': { _name: '北京市人民政府', kw: [ @@ -289,14 +272,61 @@ module.exports = { }, ], }, - 'deyang.gov.cn': { - _name: '德阳市人民政府', + 'hrss.sz.gov.cn': { + _name: '深圳考试院', '.': [ { - title: '德阳市政府公开信息', - docs: 'https://docs.rsshub.app/government.html#de-yang-shi-fu-ren-min-zheng-zheng-fu', + title: '公告', + docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-wei-zu-zhi-bu', + source: ['/*'], + target: '/gov/shenzhen/hrss/szksy/:caty/:page?', + }, + ], + }, + 'zzb.sz.gov.cn': { + _name: '深圳组工在线', + www: [ + { + title: '公告', + docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan', source: ['/*'], - target: '/sichuan/deyang/govpulicinfo/:countyName', + target: '/gov/shenzhen/zzb/:caty/:page?', + }, + ], + }, + 'sh.gov.cn': { + _name: '上海市人民政府', + wsjkw: [ + { + title: '上海卫健委 疫情通报', + docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai-yi-qing-tong-bao-shang-hai-wei-jian-wei', + source: ['/'], + target: '/gov/shanghai/wsjkw/yqtb', + }, + ], + rsj: [ + { + title: '上海市职业能力考试院 考试项目', + docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-zhi-ye-neng-li-kao-shi-yuan-kao-shi-xiang-mu', + source: ['/'], + target: '/gov/shanghai/rsj/ksxm', + }, + ], + }, + 'tqyb.com.cn': { + _name: '广州天气', + www: [ + { + title: '突发性天气提示', + docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi', + source: ['/gz/weatherAlarm/suddenWeather/'], + target: '/gov/guangdong/tqyb/tfxtq', + }, + { + title: '广东省内城市预警信号', + docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao', + source: ['/gz/weatherAlarm/otherCity/'], + target: '/gov/guangdong/tqyb/sncsyjxh', }, ], }, @@ -335,25 +365,14 @@ module.exports = { }, ], }, - 'mee.gov.cn': { - _name: '生态环境部', - www: [ - { - title: '要闻动态', - docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-sheng-tai-huan-jing-bu', - source: ['/ywdt/:category'], - target: '/gov/mee/ywdt/:category', - }, - ], - }, - 'mfa.gov.cn': { - _name: '中华人民共和国外交部', - www: [ + 'deyang.gov.cn': { + _name: '德阳市人民政府', + '.': [ { - title: '外交动态', - docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-wai-jiao-bu-wai-jiao-dong-tai', - source: ['/web/wjdt_674879/:category'], - target: (params) => `/gov/mfa/wjdt/${params.category.split('_')[0]}`, + title: '德阳市政府公开信息', + docs: 'https://docs.rsshub.app/government.html#de-yang-shi-fu-ren-min-zheng-zheng-fu', + source: ['/*'], + target: '/sichuan/deyang/govpulicinfo/:countyName/:institutionName?', }, ], }, @@ -374,6 +393,17 @@ module.exports = { }, ], }, + 'mee.gov.cn': { + _name: '生态环境部', + www: [ + { + title: '要闻动态', + docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-sheng-tai-huan-jing-bu', + source: ['/ywdt/:category'], + target: '/gov/mee/ywdt/:category', + }, + ], + }, 'pbc.gov.cn': { _name: '中国人民银行', '.': [ @@ -403,58 +433,14 @@ module.exports = { }, ], }, - 'sh.gov.cn': { - _name: '上海市人民政府', - wsjkw: [ - { - title: '上海卫健委 疫情通报', - docs: 'https://docs.rsshub.app/other.html#xin-guan-fei-yan-yi-qing-xin-wen-dong-tai-yi-qing-tong-bao-shang-hai-wei-jian-wei', - source: ['/'], - target: '/gov/shanghai/wsjkw/yqtb', - }, - ], - rsj: [ - { - title: '上海市职业能力考试院 考试项目', - docs: 'https://docs.rsshub.app/government.html#shang-hai-shi-zhi-ye-neng-li-kao-shi-yuan-kao-shi-xiang-mu', - source: ['/'], - target: '/gov/shanghai/rsj/ksxm', - }, - ], - }, - 'sz.gov.cn': { - _name: '深圳政府在线移动门户', - hrss: [ - { - title: '考试院公告', - docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-wei-zu-zhi-bu', - source: ['/*'], - target: '/gov/shenzhen/hrss/szksy/:caty/:page?', - }, - ], - zzb: [ - { - title: '组工在线公告', - docs: 'https://docs.rsshub.app/government.html#guang-dong-sheng-ren-min-zheng-fu-shen-zhen-shi-kao-shi-yuan', - source: ['/*'], - target: '/gov/shenzhen/zzb/:caty/:page?', - }, - ], - }, - 'tqyb.com.cn': { - _name: '广州天气', + 'mfa.gov.cn': { + _name: '中华人民共和国外交部', www: [ { - title: '突发性天气提示', - docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-tu-fa-xing-tian-qi-ti-shi', - source: ['/gz/weatherAlarm/suddenWeather/'], - target: '/gov/guangdong/tqyb/tfxtq', - }, - { - title: '广东省内城市预警信号', - docs: 'https://docs.rsshub.app/government.html#guang-zhou-tian-qi-guang-dong-sheng-nei-cheng-shi-yu-jing-xin-hao', - source: ['/gz/weatherAlarm/otherCity/'], - target: '/gov/guangdong/tqyb/sncsyjxh', + title: '外交动态', + docs: 'https://docs.rsshub.app/government.html#zhong-hua-ren-min-gong-he-guo-wai-jiao-bu-wai-jiao-dong-tai', + source: ['/web/wjdt_674879/:category'], + target: (params) => `/gov/mfa/wjdt/${params.category.split('_')[0]}`, }, ], }, diff --git a/lib/v2/gov/router.js b/lib/v2/gov/router.js index e539b2030fbaa2..6756683f923a37 100644 --- a/lib/v2/gov/router.js +++ b/lib/v2/gov/router.js @@ -1,5 +1,4 @@ module.exports = function (router) { - router.get(/anhui\/kjt\/([\w\d/-]+)?/, require('./anhui/kjt')); router.get('/beijing/kw/:channel', require('./beijing/kw/index')); router.get('/shenzhen/hrss/szksy/:caty/:page?', require('./shenzhen/hrss/szksy/index')); router.get('/shenzhen/zzb/:caty/:page?', require('./shenzhen/zzb/index')); @@ -9,7 +8,7 @@ module.exports = function (router) { router.get('/guangdong/tqyb/tfxtq', require('./guangdong/tqyb/tfxtq')); router.get('/guangdong/tqyb/sncsyjxh', require('./guangdong/tqyb/sncsyjxh')); router.get('/huizhou/zwgk/:category?', require('./huizhou/zwgk/index')); - router.get('/sichuan/deyang/govpulicinfo/:countyName', require('./sichuan/deyang/govpulicinfo')); + router.get('/sichuan/deyang/govpulicinfo/:countyName/:institutionName?', require('./sichuan/deyang/govpulicinfo')); router.get('/mfa/wjdt/:category?', require('./mfa/wjdt')); router.get('/miit/wjfb/:ministry', require('./miit/wjfb')); router.get('/miit/yjzj', require('./miit/yjzj')); diff --git a/lib/v2/gov/sichuan/deyang/govpulicinfo.js b/lib/v2/gov/sichuan/deyang/govpulicinfo.js index 761c0865772f9a..84db4fcf2c1a99 100644 --- a/lib/v2/gov/sichuan/deyang/govpulicinfo.js +++ b/lib/v2/gov/sichuan/deyang/govpulicinfo.js @@ -3,82 +3,112 @@ const cheerio = require('cheerio'); const { parseDate } = require('@/utils/parse-date'); const { art } = require('@/utils/render'); const path = require('path'); -const timezone = require('@/utils/timezone'); -// 各地区url信息 -const basicInfoDict = { - 绵竹市: { - rootUrl: 'https://www.mz.gov.cn', - infoUrl: 'https://www.mz.gov.cn/info/iList.jsp?tm_id=1805&cur_page=', - }, +const rootUrl = 'http://xxgk.deyang.gov.cn/xxgkml2020'; + +// 地区名称对照表 +const nameDict = { + 德阳市: 'dys', + 绵竹市: 'mzs', + 什邡市: 'sfs', + 旌阳区: 'jyq', + 罗江区: 'ljx', + 广汉市: 'ghs', + 中江县: 'zjx', + 高新区: 'gxq', }; -const getInfoUrlList = async (countyName) => { - const url = basicInfoDict[countyName].infoUrl; - const infoUrlList = []; - const expectToday = parseDate(timezone(new Date(), +8)); - for (let pageNum = 1; ; pageNum++) { - // eslint-disable-next-line no-await-in-loop - const response = await got(`${url}${pageNum}`); +const getInstitutionId = async (ctx, county) => { + const url = `${rootUrl}/ptlj.jsp?regionName=${county}`; + + return await ctx.cache.tryGet(`${county}InstitutionId`, async () => { + const response = await got.get(url); const $ = cheerio.load(response.data); - const infoList = $('#list_content > ul > li'); - // 判断当前页是否有数据 - if (infoList.length !== 0) { - for (let infoIdx = 0; infoIdx < infoList.length; infoIdx++) { - const date = parseDate($('span', infoList[infoIdx]).html()); - // 判断当前信息日期是否是今日 - if (date.getUTCFullYear() === expectToday.getUTCFullYear() && date.getUTCMonth() === expectToday.getUTCMonth() && date.getUTCDay() === expectToday.getUTCDay()) { - infoUrlList.push(`${basicInfoDict[countyName].rootUrl}${$('a', infoList[infoIdx]).attr('href')}`); - } else { - return infoUrlList; - } - } - } else { - return infoUrlList; + const dataList = $('#details_content > div > div > div > div:nth-child(4) > ul > li > a'); + const _tmp = {}; + for (let i = 0; i < dataList.length; i++) { + _tmp[$(dataList[i]).html()] = parseInt($(dataList[i]).attr('href').split('deptId=')[1]); } + return _tmp; + }); +}; + +const getInfoUrlList = async (county, institutionId) => { + const url = `${rootUrl}/gklist_iframe.jsp?deptId=${institutionId}®ionName=${county}&pageSize=15`; + const response = await got.get(url); + const $ = cheerio.load(response.data); + const pageNum = parseInt($('#list_content > div > span:nth-child(3)').html().match(/\d*/g)[1]); + const pageUrlList = []; + + // 此处建议限制最大pageNum,最大5页,单页15条 + for (let i = 1; i <= Math.min(pageNum, 5); i++) { + pageUrlList.push(`${rootUrl}/gklist_iframe.jsp?deptId=${institutionId}®ionName=${county}&pageSize=15$pageIndex=${i}`); + } + const _tmpList = await Promise.all( + pageUrlList.map(async (url) => { + const response = await got.get(url); + const $ = cheerio.load(response.data); + const InfoList = $('#list_content > ul > li > a'); + return InfoList.map((item) => `${rootUrl}/${$(InfoList[item]).attr('href')}`); + }) + ); + let infoUrlList = []; + for (let i = 0; i < _tmpList.length; i++) { + infoUrlList = infoUrlList.concat(_tmpList[i].toArray()); } + return infoUrlList; }; -// 获取信息正文内容 -const getInfoContent = async (ctx, url, countyName) => - await ctx.cache.tryGet(url, async () => { - const response = await got(url); +const getInfoContent = async (ctx, url) => { + const infoId = url.split('id=')[1].split('&type')[0]; + return await ctx.cache.tryGet(`govPublicInfo${infoId}`, async () => { + const response = await got.get(url); const $ = cheerio.load(response.data); - const fileNodes = $('#symbol > div:nth-child(4) > div > span > a'); + const fileNodes = $('#symbol > div:nth-child(3) > div > a'); const fileList = []; for (let i = 0; i < fileNodes.length; i++) { fileList.push({ name: $(fileNodes[i]).text(), - url: `${basicInfoDict[countyName].rootUrl}/${$(fileNodes[i]).attr('href')}`, + url: `${rootUrl}/${$(fileNodes[i]).attr('href')}`, }); } - const rawDate = $('#symbol > div:nth-child(1) > div:nth-child(3)').text().split(':')[1].trim(); + const rawDate = $('#symbol > div:nth-child(1) > div:nth-child(3)').text().split('\n')[1].trim(); return { - title: $('#main').text().trim(), - id: $('#symbol > div:nth-child(1) > div:nth-child(1)').text().split(':')[1].trim(), - infoNum: $('#symbol > div:nth-child(1) > div:nth-child(2) > span').text().split(':')[1].trim(), + title: $('#headline').text(), + id: infoId, + infoNum: $('#symbol > div:nth-child(1) > div:nth-child(2) > span').text().split('\n')[1].trim(), pubDate: parseDate(rawDate), date: rawDate, - keyWord: $('#symbol > div:nth-child(2) > div:nth-child(3)').text().split(':')[1].trim(), - source: $('#symbol > div:nth-child(2) > div:nth-child(2)').text().split(':')[1].trim(), - content: $('#container > div.ewb-white > div.ewb-article-detail').html(), + keyWord: $('#symbol > div:nth-child(2) > div:nth-child(1)').text().slice(8), + source: $('#symbol > div:nth-child(2) > div:nth-child(3)').text().slice(5), + content: $('#details_content > div.content').html(), file: fileList, link: url, }; }); +}; module.exports = async (ctx) => { const countyName = ctx.params.countyName; - const infoUrlList = await getInfoUrlList(countyName); + const county = nameDict[countyName]; + const institutionName = ctx.params.institutionName || ''; + let institutionId = 0; + if (institutionName) { + const institutionDict = await getInstitutionId(ctx, county); + institutionId = institutionDict[institutionName]; + } + + const infoUrlList = await getInfoUrlList(county, institutionId); const items = await Promise.all(infoUrlList.map(async (item) => await getInfoContent(ctx, item))); ctx.state.data = { - title: `政府公开信息 - ${countyName}`, - link: basicInfoDict[countyName].infoUrl, + title: `政府公开信息 - ${countyName} ${institutionName}`, + link: `${rootUrl}/gklist_iframe.jsp?deptId=${institutionId}®ionName=${county}`, item: items.map((item) => ({ title: item.title, description: art(path.resolve(__dirname, './templates/govPublicInfo.art'), { item }), link: item.link, + guid: item.id, pubDate: item.pubDate, })), }; diff --git a/lib/v2/gov/sichuan/deyang/templates/govPublicInfo.art b/lib/v2/gov/sichuan/deyang/templates/govPublicInfo.art index b05297b3131ce0..e8b9284b6c7bad 100644 --- a/lib/v2/gov/sichuan/deyang/templates/govPublicInfo.art +++ b/lib/v2/gov/sichuan/deyang/templates/govPublicInfo.art @@ -33,7 +33,6 @@ -
{{@ item.content}}
diff --git a/lib/v2/guggenheim/exhibitions.js b/lib/v2/guggenheim/exhibitions.js deleted file mode 100644 index 150152604d8e80..00000000000000 --- a/lib/v2/guggenheim/exhibitions.js +++ /dev/null @@ -1,29 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const link = 'https://www.guggenheim.org/exhibitions'; - - const response = await got({ - url: link, - method: 'GET', - }); - - const code = cheerio.load(response.data)('#app-js-extra').html(); - const data = JSON.parse(code.match(/var bootstrap = ([^\n]*);/)[1]); - const exhibitions = data.initial.main.posts.featuredExhibitions; - const items = [].concat(exhibitions.past.items ?? [], exhibitions.on_view.items ?? [], exhibitions.upcoming.items ?? []); - - ctx.state.data = { - link, - url: link, - title: 'The Guggenheim Museums and Foundation - Exhibitions', - item: items.map((ex) => ({ - title: ex.title, - link: `https://www.guggenheim.org/exhibition/${ex.slug}`, - description: ex.excerpt, - pubDate: ex.dates ? parseDate(`${ex.dates.start.month} ${ex.dates.start.day}, ${ex.dates.start.year}`, 'MMMM D, YYYY') : null, - })), - }; -}; diff --git a/lib/v2/guggenheim/maintainer.js b/lib/v2/guggenheim/maintainer.js deleted file mode 100644 index 2b582f7fce773b..00000000000000 --- a/lib/v2/guggenheim/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/exhibitions': ['chazeon'], -}; diff --git a/lib/v2/guggenheim/radar.js b/lib/v2/guggenheim/radar.js deleted file mode 100644 index 7d69aedeba0f67..00000000000000 --- a/lib/v2/guggenheim/radar.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'guggenheim.org': { - _name: 'Solomon R. Guggenheim Museum', - www: [ - { - title: 'Exhibitions', - docs: 'https://docs.rsshub.app/en/travel.html#solomon-r-guggenheim-museum', - }, - ], - }, -}; diff --git a/lib/v2/guggenheim/router.js b/lib/v2/guggenheim/router.js deleted file mode 100644 index d98b7c8845a250..00000000000000 --- a/lib/v2/guggenheim/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/exhibitions', require('./exhibitions')); -}; diff --git a/lib/v2/hameln/chapter.js b/lib/v2/hameln/chapter.js deleted file mode 100644 index 6cae1218a61dc8..00000000000000 --- a/lib/v2/hameln/chapter.js +++ /dev/null @@ -1,59 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const id = ctx.params.id; - const limit = parseInt(ctx.query.limit) || 5; - const link = `https://syosetu.org/novel/${id}`; - const $ = cheerio.load(await get(link)); - - const title = $('span[itemprop="name"]').text(); - const description = $('div.ss:nth-child(2)').text(); - - const chapter_list = $('tr[bgcolor]') - .map((_, chapter) => { - const $_chapter = $(chapter); - const chapter_link = $_chapter.find('a'); - return { - title: chapter_link.text(), - link: chapter_link.attr('href'), - pubDate: timezone(parseDate($_chapter.find('nobr').text(), 'YYYYMMDD HH:mm'), +9), - }; - }) - .toArray() - .sort((a, b) => (a.pubDate <= b.pubDate ? 1 : -1)) - .slice(0, limit); - - const item_list = await Promise.all( - chapter_list.map((chapter) => { - chapter.link = `${link}/${chapter.link}`; - return ctx.cache.tryGet(chapter.link, async () => { - const content = cheerio.load(await get(chapter.link)); - chapter.description = content('#honbun').html(); - return chapter; - }); - }) - ); - - ctx.state.data = { - title, - description, - link, - language: 'ja', - item: item_list, - }; -}; - -const get = async (url) => { - const response = await got({ - method: 'get', - url, - headers: { - cookie: 'over18=off', - }, - }); - - return response.data; -}; diff --git a/lib/v2/hameln/maintainer.js b/lib/v2/hameln/maintainer.js deleted file mode 100644 index 695fc5e37a87fb..00000000000000 --- a/lib/v2/hameln/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/chapter/:id': ['huangliangshusheng'], -}; diff --git a/lib/v2/hameln/radar.js b/lib/v2/hameln/radar.js deleted file mode 100644 index 61c71783901c9b..00000000000000 --- a/lib/v2/hameln/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'syosetu.org': { - _name: 'hameln', - '.': [ - { - title: '章节更新', - docs: 'https://docs.rsshub.app/reading.html#hameln-zhang-jie-geng-xin', - source: ['/novel/:id'], - target: '/hameln/chapter/:id', - }, - ], - }, -}; diff --git a/lib/v2/hameln/router.js b/lib/v2/hameln/router.js deleted file mode 100644 index bc094a6836e74b..00000000000000 --- a/lib/v2/hameln/router.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = (router) => router.get('/chapter/:id', require('./chapter.js')); diff --git a/lib/v2/hnrb/index.js b/lib/v2/hnrb/index.js deleted file mode 100644 index a619299ba4d10c..00000000000000 --- a/lib/v2/hnrb/index.js +++ /dev/null @@ -1,85 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const id = ctx.params.id; - - const rootUrl = 'https://hnrb.voc.com.cn'; - const currentUrl = `${rootUrl}/hnrb_epaper`; - - let response = await got({ - method: 'get', - url: currentUrl, - }); - - response = await got({ - method: 'get', - url: `${currentUrl}/${id ? response.data.match(/URL=(.*)"/)[1].replace(/node_\d+\.htm$/, `node_20${id}.htm`) : response.data.match(/URL=(.*)"/)[1]}`, - }); - - const $ = cheerio.load(response.data); - - const matches = response.data.match(/images\/(\d{4}-\d{2}\/\d{2})\/\d{2}\/\d+_brief/); - const link = `${rootUrl}/hnrb_epaper/html/${matches[1]}`; - - let items = $('tbody') - .eq(1) - .find('a') - .toArray() - .map((a) => `${link}/${$(a).attr('href').replace(/\.\//, '')}`) - .filter((a) => /div=-1$/.test(a)); - - if (!id) { - await Promise.all( - $('#pageLink') - .slice(1) - .toArray() - .map((p) => `${link}/${$(p).attr('href').replace(/\.\//, '')}`) - .map(async (p) => { - const pageResponse = await got({ - method: 'get', - url: p, - }); - - const page = cheerio.load(pageResponse.data); - - items.push( - ...page('tbody') - .eq(1) - .find('a') - .toArray() - .map((a) => `${link}/${page(a).attr('href').replace(/\.\//, '')}`) - .filter((a) => /div=-1$/.test(a)) - ); - }) - ); - } - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item, async () => { - const detailResponse = await got({ - method: 'get', - url: item, - }); - - const content = cheerio.load(detailResponse.data); - - return { - link: item, - title: content('.font01').text(), - description: content('#ozoom').html(), - pubDate: timezone(parseDate(matches[1], 'YYYY-MM/DD'), +8), - }; - }) - ) - ); - - ctx.state.data = { - title: `湖南日报${id ? ` - ${$('strong').first().parent().text()}` : ''}`, - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/hnrb/maintainer.js b/lib/v2/hnrb/maintainer.js deleted file mode 100644 index 77e7f46e2f9997..00000000000000 --- a/lib/v2/hnrb/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/:id?': ['nczitzk'], -}; diff --git a/lib/v2/hnrb/radar.js b/lib/v2/hnrb/radar.js deleted file mode 100644 index 18b274121451f8..00000000000000 --- a/lib/v2/hnrb/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'voc.com.cn': { - _name: '华声在线', - '.': [ - { - title: '湖南日报', - docs: 'https://docs.rsshub.app/journal.html#hu-nan-ri-bao-dian-zi-kan-wu', - source: ['/'], - target: '/hnrb/:id', - }, - ], - }, -}; diff --git a/lib/v2/hnrb/router.js b/lib/v2/hnrb/router.js deleted file mode 100644 index c7491b29f46f5d..00000000000000 --- a/lib/v2/hnrb/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/:id?', require('./index')); -}; diff --git a/lib/v2/hupu/all.js b/lib/v2/hupu/all.js deleted file mode 100644 index 5f470209622ba5..00000000000000 --- a/lib/v2/hupu/all.js +++ /dev/null @@ -1,73 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); - -module.exports = async (ctx) => { - const id = ctx.params.id ?? 'topic-daily'; - - const rootUrl = 'https://bbs.hupu.com'; - const currentUrl = `${rootUrl}/${id}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - let items = $('div.t-info > a, a.p-title') - .toArray() - .map((item) => { - item = $(item); - - return { - title: item.text(), - link: `https://m.hupu.com/bbs${item.attr('href')}`, - pubDate: timezone(parseDate(item.parent().parent().find('.post-time').text(), 'MM-DD HH:mm'), +8), - }; - }); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - try { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - const videos = []; - - content('.thread-video-wrap').each(function () { - videos.push(content('video').attr('src')); - content(this).remove(); - }); - - content('.bbs-user-info-time span').remove(); - - item.author = content('.bbs-user-info-name').first().text(); - item.pubDate = item.pubDate ?? timezone(parseRelativeDate(content('.bbs-user-info-time').first().text()), +8); - item.description = art(path.join(__dirname, 'templates/description.art'), { - videos, - description: content('.bbs-thread-content').html(), - }); - } catch (e) { - // no-empty - } - - return item; - }) - ) - ); - - ctx.state.data = { - title: `虎扑社区 - ${$('.middle-title, .bbs-sl-web-intro-detail-title').text()}`, - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/hupu/bbs.js b/lib/v2/hupu/bbs.js deleted file mode 100644 index 1829cc1d466438..00000000000000 --- a/lib/v2/hupu/bbs.js +++ /dev/null @@ -1,64 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseRelativeDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); - -module.exports = async (ctx) => { - const id = ctx.params.id ?? '34'; - const order = ctx.params.order ?? '1'; - - const rootUrl = 'https://m.hupu.com'; - const currentUrl = `${rootUrl}/api/v1/bbs-forumthreadlist-frontend/${id}-1?postdate=${order}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - let items = response.data.data.t_list.map((item) => ({ - title: item.title, - link: `${rootUrl}/bbs/${item.tid}.html`, - pubDate: timezone(parseRelativeDate(item.t_post), +8), - })); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - try { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - const videos = []; - - content('.thread-video-wrap').each(function () { - videos.push(content('video').attr('src')); - content(this).remove(); - }); - - item.author = content('.bbs-user-info-name').first().text(); - item.description = art(path.join(__dirname, 'templates/description.art'), { - videos, - description: content('#bbs-thread-content').html(), - }); - } catch (e) { - // no-empty - } - - return item; - }) - ) - ); - - ctx.state.data = { - title: `虎扑社区 - ${response.data.data.keywords}`, - link: currentUrl, - item: items, - description: response.data.data.description, - }; -}; diff --git a/lib/v2/hupu/index.js b/lib/v2/hupu/index.js deleted file mode 100644 index dda25a1f72b869..00000000000000 --- a/lib/v2/hupu/index.js +++ /dev/null @@ -1,72 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -const categories = { - nba: { - title: 'NBA', - data: 'news', - }, - cba: { - title: 'CBA', - data: 'news', - }, - soccer: { - title: '足球', - data: 'soccerIndexData', - }, -}; - -module.exports = async (ctx) => { - const category = ctx.params.category ?? 'soccer'; - - const rootUrl = 'https://m.hupu.com'; - const currentUrl = `${rootUrl}/${category}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const data = JSON.parse(response.data.match(/"pageProps":(.*)},"page":"\//)[1]); - - let items = data[categories[category].data].map((item) => ({ - title: item.title, - pubDate: timezone(parseDate(item.publishTime), +8), - link: item.link.replace(/bbs\.hupu.com/, 'm.hupu.com/bbs'), - })); - - items = await Promise.all( - items - .filter((item) => !/subject/.test(item.link)) - .map((item) => - ctx.cache.tryGet(item.link, async () => { - try { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - item.author = content('.bbs-user-info-name').text(); - item.description = content('#bbs-thread-content').html(); - item.category = content('.bbs-link') - .toArray() - .map((c) => content(c).text()); - } catch (e) { - // no-empty - } - - return item; - }) - ) - ); - - ctx.state.data = { - title: `虎扑 - ${categories[category].title}`, - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/hupu/maintainer.js b/lib/v2/hupu/maintainer.js deleted file mode 100644 index 6460c3dafd0fd7..00000000000000 --- a/lib/v2/hupu/maintainer.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - '/all/:id?': ['nczitzk'], - '/bbs/:id?/:order?': ['LogicJake', 'nczitzk'], - '/bxj/:id?/:order?': ['LogicJake', 'nczitzk'], - '/dept/:category?': ['nczitzk'], - '/:category?': ['nczitzk'], -}; diff --git a/lib/v2/hupu/radar.js b/lib/v2/hupu/radar.js deleted file mode 100644 index c4941233d2d48c..00000000000000 --- a/lib/v2/hupu/radar.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = { - 'hupu.com': { - _name: '虎扑', - '': [ - { - title: '首页', - docs: 'https://docs.rsshub.app/bbs.html#hu-pu-shou-ye', - source: ['/:category', '/'], - target: '/hupu/:category', - }, - ], - bbs: [ - { - title: '热帖', - docs: 'https://docs.rsshub.app/bbs.html#hu-pu-re-tie', - source: ['/:id'], - target: '/hupu/all/:id', - }, - ], - m: [ - { - title: '首页', - docs: 'https://docs.rsshub.app/bbs.html#hu-pu-shou-ye', - source: ['/:category', '/'], - target: '/hupu/:category', - }, - { - title: '社区', - docs: 'https://docs.rsshub.app/bbs.html#hu-pu-she-qu', - source: ['/bbs/:id', '/'], - target: '/hupu/bbs/:id/:order', - }, - ], - }, -}; diff --git a/lib/v2/hupu/router.js b/lib/v2/hupu/router.js deleted file mode 100644 index e4da8e83b28bed..00000000000000 --- a/lib/v2/hupu/router.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = function (router) { - router.get('/all/:id?', require('./all')); - router.get('/bbs/:id?/:order?', require('./bbs')); - router.get('/bxj/:id?/:order?', require('./bbs')); - router.get('/dept/:category?', require('./index')); - router.get('/:category?', require('./index')); -}; diff --git a/lib/v2/hupu/templates/description.art b/lib/v2/hupu/templates/description.art deleted file mode 100644 index 73610b2e60c02d..00000000000000 --- a/lib/v2/hupu/templates/description.art +++ /dev/null @@ -1,6 +0,0 @@ -{{ if videos }} -{{ each videos video}} - -{{/each}} -{{ /if }} -{{@ description }} \ No newline at end of file diff --git a/lib/v2/hyqss/index.js b/lib/v2/hyqss/index.js deleted file mode 100644 index cba66931b7b7f4..00000000000000 --- a/lib/v2/hyqss/index.js +++ /dev/null @@ -1,89 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const type = ctx.params.type ?? 'hyrb'; - const isDaily = type === 'hyrb'; - - const id = ctx.params.id; - - const rootUrl = 'http://epaper.hyqss.cn'; - const currentUrl = `${rootUrl}${isDaily ? '' : `/${type}`}`; - - let response = await got({ - method: 'get', - url: currentUrl, - }); - - const url = response.data.match(/URL=(.*)"/)[1]; - - response = await got({ - method: 'get', - url: `${currentUrl}/${id ? url.replace(/node_\d+\.htm/, `node_19${isDaily ? '62' : '74'}${id}.htm`) : url}`, - }); - - const $ = cheerio.load(response.data); - - const matches = url.match(/html\/(.*)\/node/); - const link = `${rootUrl}/${isDaily ? '' : 'hywb/'}html/${matches[1]}`; - - let items = $('#main-ed-articlenav-list') - .first() - .find('a') - .toArray() - .map((a) => `${link}/${$(a).attr('href')}`); - - if (!id) { - await Promise.all( - $('#bmdhTable') - .find('#pageLink') - .toArray() - .map((p) => `${link}/${$(p).attr('href')}`) - .map(async (p) => { - const pageResponse = await got({ - method: 'get', - url: p, - }); - - const page = cheerio.load(pageResponse.data); - - items.push( - ...page('#main-ed-articlenav-list') - .first() - .find('a') - .toArray() - .map((a) => `${link}/${page(a).attr('href')}`) - ); - }) - ); - } - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item, async () => { - const detailResponse = await got({ - method: 'get', - url: item, - }); - - const content = cheerio.load(detailResponse.data); - - return { - link: item, - title: content('.font01').text(), - description: content('#ozoom').html(), - pubDate: timezone(parseDate(matches[1], 'YYYY-MM/DD'), +8), - }; - }) - ) - ); - - ctx.state.data = { - title: `衡阳${isDaily ? '日' : '晚'}报${id ? ` - ${$('strong').first().parent().text()}` : ''}`, - link: currentUrl, - item: items, - allowEmpty: true, - }; -}; diff --git a/lib/v2/hyqss/maintainer.js b/lib/v2/hyqss/maintainer.js deleted file mode 100644 index ca9e7a45244be6..00000000000000 --- a/lib/v2/hyqss/maintainer.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - '/hyrb/:id?': ['nczitzk'], - '/hywb/:id?': ['nczitzk'], -}; diff --git a/lib/v2/hyqss/radar.js b/lib/v2/hyqss/radar.js deleted file mode 100644 index 2ee78b5ff90d9e..00000000000000 --- a/lib/v2/hyqss/radar.js +++ /dev/null @@ -1,22 +0,0 @@ -const radars = [ - { - title: '衡阳日报', - docs: 'https://docs.rsshub.app/journal.html#heng-yang-quan-sou-suo-heng-yang-ri-bao', - source: ['/'], - target: '/hnrb/hyrb/:id?', - }, - { - title: '衡阳晚报', - docs: 'https://docs.rsshub.app/journal.html#heng-yang-quan-sou-suo-heng-yang-wan-bao', - source: ['/'], - target: '/hnrb/hywb/:id?', - }, -]; - -module.exports = { - 'hyqss.cn': { - _name: '衡阳全搜索', - '.': radars, - epaper: radars, - }, -}; diff --git a/lib/v2/hyqss/router.js b/lib/v2/hyqss/router.js deleted file mode 100644 index 5f136f299b1c03..00000000000000 --- a/lib/v2/hyqss/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/:type?/:id?', require('./index')); -}; diff --git a/lib/v2/jewishmuseum/exhibitions.js b/lib/v2/jewishmuseum/exhibitions.js deleted file mode 100644 index ae5bc01cc4ee81..00000000000000 --- a/lib/v2/jewishmuseum/exhibitions.js +++ /dev/null @@ -1,16 +0,0 @@ -const buildData = require('@/utils/common-config'); - -module.exports = async (ctx) => { - const link = 'https://thejewishmuseum.org/exhibitions'; - - ctx.state.data = await buildData({ - link, - url: link, - title: 'Jewish Museums - Exhibitions', - item: { - item: '#current article.exhibition, #upcoming article, #past article.exhibition', - title: `$('article.exhibition h3').text()`, - link: `$('article.exhibition > a').attr('href')`, - }, - }); -}; diff --git a/lib/v2/jewishmuseum/maintainer.js b/lib/v2/jewishmuseum/maintainer.js deleted file mode 100644 index 2b582f7fce773b..00000000000000 --- a/lib/v2/jewishmuseum/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/exhibitions': ['chazeon'], -}; diff --git a/lib/v2/jewishmuseum/radar.js b/lib/v2/jewishmuseum/radar.js deleted file mode 100644 index 223b1a7af374f1..00000000000000 --- a/lib/v2/jewishmuseum/radar.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'thejewishmuseum.org': { - _name: 'Jewish Museum', - '.': [ - { - title: 'Exhibitions', - docs: 'https://docs.rsshub.app/en/travel.html#the-jewish-museum', - }, - ], - }, -}; diff --git a/lib/v2/jewishmuseum/router.js b/lib/v2/jewishmuseum/router.js deleted file mode 100644 index d98b7c8845a250..00000000000000 --- a/lib/v2/jewishmuseum/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/exhibitions', require('./exhibitions')); -}; diff --git a/lib/v2/kakuyomu/episode.js b/lib/v2/kakuyomu/episode.js deleted file mode 100644 index 383fd4b6b1fd2d..00000000000000 --- a/lib/v2/kakuyomu/episode.js +++ /dev/null @@ -1,54 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const id = ctx.params.id; - const limit = parseInt(ctx.query.limit) || 5; - const work_url = `https://kakuyomu.jp/works/${id}`; - const $ = cheerio.load(await get(work_url)); - - const work_title = $('#workTitle').text(); - const introduction = $('#introduction').text(); - - const episode_list = $('a.widget-toc-episode-episodeTitle') - .map((_, episode) => { - const $_episode = $(episode); - return { - title: $_episode.find('span').text(), - link: $_episode.attr('href'), - pubDate: parseDate($_episode.find('time').attr('datetime')), - }; - }) - .toArray() - .sort((a, b) => (a.pubDate <= b.pubDate ? 1 : -1)) - .slice(0, limit); - - const item_list = await Promise.all( - episode_list.map((episode) => - ctx.cache.tryGet(episode.link, async () => { - episode.link = `https://kakuyomu.jp${episode.link}`; - const content = cheerio.load(await get(episode.link)); - episode.description = content('.widget-episodeBody').html(); - return episode; - }) - ) - ); - - ctx.state.data = { - title: work_title, - link: work_url, - description: introduction, - language: 'ja', - item: item_list, - }; -}; - -const get = async (url) => { - const response = await got({ - method: 'get', - url, - }); - - return response.data; -}; diff --git a/lib/v2/kakuyomu/maintainer.js b/lib/v2/kakuyomu/maintainer.js deleted file mode 100644 index ee25bceb544d7c..00000000000000 --- a/lib/v2/kakuyomu/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/episode/:id': ['huangliangshusheng'], -}; diff --git a/lib/v2/kakuyomu/radar.js b/lib/v2/kakuyomu/radar.js deleted file mode 100644 index a49a6f50073dfc..00000000000000 --- a/lib/v2/kakuyomu/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'kakuyomu.jp': { - _name: 'kakuyomu', - '.': [ - { - title: '章节更新', - docs: 'https://docs.rsshub.app/reading.html#kakuyomu-zhang-jie-geng-xin', - source: ['/works/:id'], - target: '/kakuyomu/episode/:id', - }, - ], - }, -}; diff --git a/lib/v2/kakuyomu/router.js b/lib/v2/kakuyomu/router.js deleted file mode 100644 index 23c9c2865f4ee4..00000000000000 --- a/lib/v2/kakuyomu/router.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = (router) => router.get('/episode/:id', require('./episode.js')); diff --git a/lib/v2/kyodonews/index.js b/lib/v2/kyodonews/index.js deleted file mode 100644 index b80ef5a3e046d1..00000000000000 --- a/lib/v2/kyodonews/index.js +++ /dev/null @@ -1,123 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); - -const resolveRelativeLink = (link, baseUrl) => (link.startsWith('http') ? link : `${baseUrl}${link}`); - -module.exports = async (ctx) => { - const language = ctx.params.language ?? 'china'; - const keyword = ctx.params.keyword === 'RSS' ? 'rss' : ctx.params.keyword ?? ''; - - // raise error for invalid languages - if (!['china', 'tchina'].includes(language)) { - throw Error('Invalid language'); - } - - const rootUrl = `https://${language}.kyodonews.net`; - const currentUrl = `${rootUrl}/${keyword ? (keyword === 'rss' ? 'rss/news.xml' : `news/${keyword}`) : ''}`; - - let response; - try { - response = await got(currentUrl); - } catch (e) { - throw e.response && e.response.statusCode === 404 ? new Error('Invalid keyword') : e; - } - - const $ = cheerio.load(response.data, { xmlMode: keyword === 'rss' }); - - let title, description, image, items; - image = `${rootUrl}/apple-touch-icon-180x180.png`; - - if (keyword === 'rss') { - title = $('channel > title').text(); - description = $('channel > description').text(); - items = $('item') - .map((_, item) => { - const $item = $(item); - const link = $item.find('link').text(); - // const pubDate = $item.find('pubDate').text(); - return { - link, - // pubDate, // no need to normalize because it's from a valid RSS feed - }; - }) - .get(); - } else { - title = $('head > title').text(); - description = $('meta[name="description"]').attr('content'); - image = resolveRelativeLink($('head > link[rel="apple-touch-icon"]').attr('href'), rootUrl) || image; - items = $('div.sec-latest > ul > li') - .map((_, item) => { - item = $(item); - const link = item.find('a').attr('href'); - return { - link: resolveRelativeLink(link, rootUrl), - }; - }) - .get(); - } - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got(item.link); - - const $ = cheerio.load(detailResponse.data); - item.title = $('head > title').text(); - item.author = $('meta[name="author"]').attr('content'); - - // add main pic - const mainPicArea = $('div.mainpic'); - mainPicArea.find('div').each((_, elem) => { - elem = $(elem); - elem.css('text-align', 'center'); - }); - // moving `data-src` to `src` - mainPicArea.find('img').each((_, img) => { - img = $(img); - img.attr('src', img.attr('data-src')); - img.removeAttr('data-src'); - img.wrap('
'); - }); - let mainPic = mainPicArea.html(); - mainPic = mainPic ? mainPic.trim() : ''; - - // add article body - let articleBody = $('div.article-body').html(); - articleBody = articleBody ? articleBody.trim().replace(/(完)(?=<\/p>\s*$)/m, '') : ''; - - // render description - item.description = art(path.join(__dirname, 'templates/article.art'), { - mainPic, - articleBody, - }); - - const ldJson = $('script[type="application/ld+json"]').html(); - const pubDate_match = ldJson && ldJson.match(/"datePublished":"([\d\s-:]*?)"/); - const updated_match = ldJson && ldJson.match(/"dateModified":"([\d\s-:]*?)"/); - if (pubDate_match) { - item.pubDate = timezone(parseDate(pubDate_match[1]), 9); - } - if (updated_match) { - item.updated = timezone(parseDate(updated_match[1]), 9); - } - - item.category = $('p.credit > a') - .map((_, a) => $(a).text()) - .get(); - return item; - }) - ) - ); - - ctx.state.data = { - title, - description, - link: currentUrl, - item: items, - image, - }; -}; diff --git a/lib/v2/kyodonews/maintainer.js b/lib/v2/kyodonews/maintainer.js deleted file mode 100644 index 0ac170398f25f4..00000000000000 --- a/lib/v2/kyodonews/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/:language?/:keyword?': ['Rongronggg9'], -}; diff --git a/lib/v2/kyodonews/radar.js b/lib/v2/kyodonews/radar.js deleted file mode 100644 index a9b5460e6320c6..00000000000000 --- a/lib/v2/kyodonews/radar.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - 'kyodonews.net': { - _name: '共同网', - china: [ - { - title: '最新报道', - docs: 'https://docs.rsshub.app/traditional-media.html#gong-tong-wang-zui-xin-bao-dao', - source: '/', - target: '/kyodonews/china', - }, - { - title: '关键词', - docs: 'https://docs.rsshub.app/traditional-media.html#gong-tong-wang-zui-xin-bao-dao', - source: '/news/:keyword', - target: '/kyodonews/china/:keyword?', - }, - ], - tchina: [ - { - title: '最新報道', - docs: 'https://docs.rsshub.app/traditional-media.html#gong-tong-wang-zui-xin-bao-dao', - source: '/', - target: '/kyodonews/tchina', - }, - { - title: '關鍵詞', - docs: 'https://docs.rsshub.app/traditional-media.html#gong-tong-wang-zui-xin-bao-dao', - source: '/news/:keyword', - target: '/kyodonews/tchina/:keyword?', - }, - ], - }, -}; diff --git a/lib/v2/kyodonews/router.js b/lib/v2/kyodonews/router.js deleted file mode 100644 index c4f4963474d0b9..00000000000000 --- a/lib/v2/kyodonews/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/:language?/:keyword?', require('./index')); -}; diff --git a/lib/v2/kyodonews/templates/article.art b/lib/v2/kyodonews/templates/article.art deleted file mode 100644 index ac741750228f11..00000000000000 --- a/lib/v2/kyodonews/templates/article.art +++ /dev/null @@ -1,4 +0,0 @@ -{{ if mainPic }} -{{@ mainPic }}

-{{ /if }} -{{@ articleBody }} diff --git a/lib/v2/mcachicago/exhibitions.js b/lib/v2/mcachicago/exhibitions.js deleted file mode 100644 index 9fe1e4b41ea71b..00000000000000 --- a/lib/v2/mcachicago/exhibitions.js +++ /dev/null @@ -1,17 +0,0 @@ -const buildData = require('@/utils/common-config'); - -module.exports = async (ctx) => { - const link = 'https://mcachicago.org/exhibitions'; - - ctx.state.data = await buildData({ - link, - url: link, - title: 'MCA Chicago - Exhibitions', - item: { - item: '#exhibitions .card', - title: `$('.title').text()`, - link: `$('a').attr('href')`, - // description: `$('a').html()`, - }, - }); -}; diff --git a/lib/v2/mcachicago/maintainer.js b/lib/v2/mcachicago/maintainer.js deleted file mode 100644 index 2b582f7fce773b..00000000000000 --- a/lib/v2/mcachicago/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/exhibitions': ['chazeon'], -}; diff --git a/lib/v2/mcachicago/radar.js b/lib/v2/mcachicago/radar.js deleted file mode 100644 index 8d24a4852f5e2e..00000000000000 --- a/lib/v2/mcachicago/radar.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'mcachicago.org': { - _name: 'MCA Chicago', - '.': [ - { - title: 'Exhibitions', - docs: 'https://docs.rsshub.app/en/travel.html#museum-of-contemporary-art-chicago', - }, - ], - }, -}; diff --git a/lib/v2/mcachicago/router.js b/lib/v2/mcachicago/router.js deleted file mode 100644 index d98b7c8845a250..00000000000000 --- a/lib/v2/mcachicago/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/exhibitions', require('./exhibitions')); -}; diff --git a/lib/v2/metmuseum/exhibitions.js b/lib/v2/metmuseum/exhibitions.js deleted file mode 100644 index 6297491490a0f5..00000000000000 --- a/lib/v2/metmuseum/exhibitions.js +++ /dev/null @@ -1,31 +0,0 @@ -const got = require('@/utils/got'); -const { parseDate } = require('@/utils/parse-date'); - -function generateExhibitionItem(result) { - return { - title: result.title, - link: `https://www.metmuseum.org${result.url}`, - description: result.description, - pubDate: parseDate(result.startDate), - guid: result.id, - }; -} - -module.exports = async (ctx) => { - const searchType = ctx.params.state ?? 'current'; - - const url = `https://www.metmuseum.org/ghidorah/ExhibitionListing/Search?searchType=${searchType}`; - - const response = await got({ - url, - method: 'GET', - }); - - const data = response.data.data; - - ctx.state.data = { - title: 'The Metropolitan Museum of Art - Exhibitions', - link: 'https://www.metmuseum.org/exhibitions', - item: data.results.map(generateExhibitionItem), - }; -}; diff --git a/lib/v2/metmuseum/maintainer.js b/lib/v2/metmuseum/maintainer.js deleted file mode 100644 index 2b582f7fce773b..00000000000000 --- a/lib/v2/metmuseum/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/exhibitions': ['chazeon'], -}; diff --git a/lib/v2/metmuseum/radar.js b/lib/v2/metmuseum/radar.js deleted file mode 100644 index c7154582d81ab3..00000000000000 --- a/lib/v2/metmuseum/radar.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'metmuseum.org': { - _name: 'The Metropolitan Museum of Art', - www: [ - { - title: 'Exhibitions', - docs: 'https://docs.rsshub.app/en/travel.html#the-metropolitan-museum-of-art', - }, - ], - }, -}; diff --git a/lib/v2/metmuseum/router.js b/lib/v2/metmuseum/router.js deleted file mode 100644 index 3b6bc4063e9c62..00000000000000 --- a/lib/v2/metmuseum/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/exhibitions/:state?', require('./exhibitions')); -}; diff --git a/lib/v2/mihoyo/bbs.js b/lib/v2/mihoyo/bbs.js deleted file mode 100644 index eabd10463cc655..00000000000000 --- a/lib/v2/mihoyo/bbs.js +++ /dev/null @@ -1,62 +0,0 @@ -const got = require('@/utils/got'); -const { art } = require('@/utils/render'); -const path = require('path'); -const { parseDate } = require('@/utils/parse-date'); -// 游戏id -const GITS_MAP = { - 1: '崩坏三', - 2: '原神', - 3: '崩坏二', - 4: '未定事件簿', - 6: '崩坏:星穹铁道', -}; - -// 公告类型 -const TYPE_MAP = { - 1: '公告', - 2: '活动', - 3: '资讯', -}; - -const renderDescription = (description, images) => art(path.join(__dirname, 'templates/description.art'), { description, images }); - -module.exports = async (ctx) => { - const { gids, type = '2', page_size = '20', last_id = '' } = ctx.params; - const query = new URLSearchParams({ - gids, - type, - page_size, - last_id, - }).toString(); - const url = `https://bbs-api.mihoyo.com/post/wapi/getNewsList?${query}`; - const response = await got({ - method: 'get', - url, - }); - const list = response?.data?.data?.list; - if (!list) { - throw new Error('未获取到数据!'); - } - const title = `米游社 - ${GITS_MAP[gids] || ''} - ${TYPE_MAP[type] || ''}`; - const items = list.map((e) => { - const author = e.user.nickname; - const title = e.post.subject; - const link = `https://bbs.mihoyo.com/ys/article/${e.post.post_id}`; - const description = renderDescription(e.post.content, e.post.images); - const pubDate = parseDate(e.post.created_at * 1000); - return { - author, - title, - link, - description, - pubDate, - }; - }); - const data = { - title, - link: url, - item: items, - }; - - ctx.state.data = data; -}; diff --git a/lib/v2/mihoyo/maintainer.js b/lib/v2/mihoyo/maintainer.js deleted file mode 100644 index a18b6786d8d296..00000000000000 --- a/lib/v2/mihoyo/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/bbs/official/:gids/:type?/:page_size?/:last_id?': ['CaoMeiYouRen'], -}; diff --git a/lib/v2/mihoyo/radar.js b/lib/v2/mihoyo/radar.js deleted file mode 100644 index f34d15a2fbd996..00000000000000 --- a/lib/v2/mihoyo/radar.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - 'mihoyo.com': { - _name: '米游社v2', - bbs: [ - { - title: '米游社 - 官方公告', - docs: 'https://docs.rsshub.app/game.html#mi-ha-you-mi-you-she-guan-fang-gong-gao', - // source: ['/ys/home/28', '/bh3/home/6', '/bh2/home/31', '/wd/home/33', '/sr/home/53'], - source: ['/:game/home/28', '/:game/home/6', '/:game/home/31', '/:game/home/33', '/:game/home/53'], - target: (params, url) => { - const GITS_MAP = { - bh3: 1, // '崩坏三', - ys: 2, // '原神', - bh2: 3, // '崩坏二', - wd: 4, // '未定事件簿', - sr: 6, // '崩坏:星穹铁道', - }; - const { game } = params; - const gids = GITS_MAP[game]; - if (!gids) { - return ''; - } - const { type = '2' } = new URL(url).searchParams; - const page_size = '20'; - const last_id = ''; - return `/mihoyo/bbs/official/${gids}/${type}/${page_size}/${last_id}`; - }, - }, - ], - }, -}; diff --git a/lib/v2/mihoyo/router.js b/lib/v2/mihoyo/router.js deleted file mode 100644 index b0bd1b78363b93..00000000000000 --- a/lib/v2/mihoyo/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/bbs/official/:gids/:type?/:page_size?/:last_id?', require('./bbs')); -}; diff --git a/lib/v2/mihoyo/templates/description.art b/lib/v2/mihoyo/templates/description.art deleted file mode 100644 index c195aad3b68084..00000000000000 --- a/lib/v2/mihoyo/templates/description.art +++ /dev/null @@ -1,6 +0,0 @@ -{{ description }} -{{if images}} - {{each images}} - - {{/each}} -{{/if}} diff --git a/lib/v2/mpaypass/maintainer.js b/lib/v2/mpaypass/maintainer.js deleted file mode 100644 index fb515afb6f004b..00000000000000 --- a/lib/v2/mpaypass/maintainer.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - '/main/:type?': ['zhuan-zhu'], - '/news': ['LogicJake', 'genghis-yang'], -}; diff --git a/lib/v2/mpaypass/news.js b/lib/v2/mpaypass/news.js deleted file mode 100644 index 5dbb471c88f1b2..00000000000000 --- a/lib/v2/mpaypass/news.js +++ /dev/null @@ -1,39 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); -const timezone = require('@/utils/timezone'); - -module.exports = async (ctx) => { - const link = 'http://m.mpaypass.com.cn'; - const listData = await got(link); - const $list = cheerio.load(listData.data); - ctx.state.data = { - title: '新闻 - 移动支付网', - link, - language: 'zh-CN', - item: await Promise.all( - $list('.Newslist-li') - .map((_, el) => { - const $el = $list(el); - const $a = $el.find('.Newslist-title a'); - const href = $a.attr('href'); - const title = $a.text(); - const date = $el.find('.Newslist-time span').text(); - - return ctx.cache.tryGet(href, async () => { - const contentData = await got.get(href); - const $content = cheerio.load(contentData.data); - const description = $content('.newslist-body').html(); - - return { - title, - description, - link: href, - pubDate: timezone(parseDate(date), +8), - }; - }); - }) - .get() - ), - }; -}; diff --git a/lib/v2/mpaypass/radar.js b/lib/v2/mpaypass/radar.js deleted file mode 100644 index 65b31f511367d9..00000000000000 --- a/lib/v2/mpaypass/radar.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - 'mpaypass.com.cn': { - _name: '移动支付网', - '.': [ - { - title: '新闻', - docs: 'https://docs.rsshub.app/new-media.html#yi-dong-zhi-fu-wang', - source: '/', - target: '/mpaypass/news', - }, - { - title: '分类', - docs: 'https://docs.rsshub.app/new-media.html#yi-dong-zhi-fu-wang', - source: ['/:type', '/'], - target: (params) => `/mpaypass/main/${params.type.replace('.html', '')}`, - }, - ], - }, -}; diff --git a/lib/v2/mpaypass/router.js b/lib/v2/mpaypass/router.js deleted file mode 100644 index 3d20601e67fb92..00000000000000 --- a/lib/v2/mpaypass/router.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = (router) => { - router.get('/main/:type?', require('./main')); - router.get('/news', require('./news')); -}; diff --git a/lib/v2/mtime/maintainer.js b/lib/v2/mtime/maintainer.js deleted file mode 100644 index ae0ebe64216aa0..00000000000000 --- a/lib/v2/mtime/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/mtime/news': ['TsSmartTT'], -}; diff --git a/lib/v2/mtime/news.js b/lib/v2/mtime/news.js deleted file mode 100644 index e939db6b8827fb..00000000000000 --- a/lib/v2/mtime/news.js +++ /dev/null @@ -1,48 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const link = 'http://news.mtime.com/'; - const response = await got({ - method: 'get', - url: link, - }); - const $ = cheerio.load(response.data); - const list = $('ul.left-cont.fix li') - .map((_, item) => { - item = $(item); - return { - title: item.find('h4 a').text(), - link: item.find('h4 a').attr('href'), - }; - }) - .get(); - - const items = await Promise.all( - list.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - const content = cheerio.load(detailResponse.data); - - content('.DRE-subject-wrapper').remove(); - - item.author = content('.editor').text().replace('编辑:', ''); - item.description = content('.body').first().html(); - item.pubDate = timezone(parseDate(content('.userCreateTime').text()), 8); - - return item; - }) - ) - ); - - ctx.state.data = { - title: 'Mtime时光网 - 资讯', - link, - item: items, - }; -}; diff --git a/lib/v2/mtime/radar.js b/lib/v2/mtime/radar.js deleted file mode 100644 index 113c4feff5fefc..00000000000000 --- a/lib/v2/mtime/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'mtime.com': { - _name: '时光网', - news: [ - { - title: '资讯', - docs: 'https://docs.rsshub.app/multimedia.html#shi-guang-wang', - source: '/', - target: '/mtime/news', - }, - ], - }, -}; diff --git a/lib/v2/mtime/router.js b/lib/v2/mtime/router.js deleted file mode 100644 index 69a5972f6a8112..00000000000000 --- a/lib/v2/mtime/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/news', require('./news')); -}; diff --git a/lib/v2/natgeo/dailyphoto.js b/lib/v2/natgeo/dailyphoto.js deleted file mode 100644 index a63d19bbdd19b9..00000000000000 --- a/lib/v2/natgeo/dailyphoto.js +++ /dev/null @@ -1,32 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); -const config = require('@/config').value; - -module.exports = async (ctx) => { - const rootUrl = 'https://www.nationalgeographic.com'; - const apiUrl = `${rootUrl}/photo-of-the-day`; - const response = await ctx.cache.tryGet(apiUrl, async () => (await got(apiUrl)).data, config.cache.contentExpire, false); - const $ = cheerio.load(response); - - const natgeo = JSON.parse($.html().match(/window\['__natgeo__'\]=(.*);/)[1]); - const media = natgeo.page.content.mediaspotlight.frms[0].mods[0].edgs[1].media; - - const items = media.map((item) => ({ - title: item.meta.title, - description: art(path.join(__dirname, 'templates/dailyPhoto.art'), { - img: item.img, - }), - link: rootUrl + item.locator, - pubDate: parseDate(item.caption.preHeading), - author: item.img.crdt, - })); - - ctx.state.data = { - title: 'Nat Geo Photo of the Day', - link: apiUrl, - item: items, - }; -}; diff --git a/lib/v2/natgeo/dailyselection.js b/lib/v2/natgeo/dailyselection.js deleted file mode 100644 index 843c92f13fd9ec..00000000000000 --- a/lib/v2/natgeo/dailyselection.js +++ /dev/null @@ -1,41 +0,0 @@ -const got = require('@/utils/got'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const host = 'http://dili.bdatu.com/jiekou/mains/p1.html'; - const data = await got(host); - - let sort = 0; - let addtime = ''; - - for (let i = 0; i < data.data.album.length; i++) { - if (parseInt(data.data.album[i].ds) === 1) { - sort = data.data.album[i].sort; - addtime = data.data.album[i].addtime; - break; - } - } - const api = 'http://dili.bdatu.com/jiekou/albums/a' + sort + '.html'; - const response = await got(api); - const items = response.data.picture; - const out = new Array(); - - items.map((item) => { - const info = { - title: item.title, - link: item.url, - description: `
` + item.content, - pubDate: timezone(parseDate(addtime), +0), - guid: item.id, - }; - out.push(info); - return info; - }); - - ctx.state.data = { - title: 'Photo of the Daily Selection', - link: api, - item: out, - }; -}; diff --git a/lib/v2/natgeo/maintainer.js b/lib/v2/natgeo/maintainer.js deleted file mode 100644 index a8d19f4cf41b54..00000000000000 --- a/lib/v2/natgeo/maintainer.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - '/dailyselection': ['OrangeEd1t'], - '/dailyphoto': ['LogicJake', 'OrangeEd1t', 'TonyRL'], - '/:cat/:type?': ['fengkx'], -}; diff --git a/lib/v2/natgeo/radar.js b/lib/v2/natgeo/radar.js deleted file mode 100644 index efe95bcdc7d6a2..00000000000000 --- a/lib/v2/natgeo/radar.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - 'nationalgeographic.com': { - _name: '国家地理', - '.': [ - { - title: '每日一图', - docs: 'https://docs-rsshub.pages.dev/picture.html#guo-jia-di-li', - source: ['/photo-of-the-day/*', '/'], - target: '/natgeo/dailyphoto', - }, - ], - }, - 'natgeomedia.com': { - _name: '国家地理', - '.': [ - { - title: '分类', - docs: 'https://docs.rsshub.app/travel.html#guo-jia-di-li', - source: ['/:cat/:type', '/'], - target: '/natgeo/:cat/:type', - }, - ], - }, -}; diff --git a/lib/v2/natgeo/router.js b/lib/v2/natgeo/router.js deleted file mode 100644 index d85de81184d0a0..00000000000000 --- a/lib/v2/natgeo/router.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = (router) => { - router.get('/dailyphoto', require('./dailyphoto')); - router.get('/dailyselection', require('./dailyselection')); - router.get('/:cat/:type?', require('./natgeo')); -}; diff --git a/lib/v2/natgeo/templates/dailyPhoto.art b/lib/v2/natgeo/templates/dailyPhoto.art deleted file mode 100644 index 004525a04fd460..00000000000000 --- a/lib/v2/natgeo/templates/dailyPhoto.art +++ /dev/null @@ -1,5 +0,0 @@ -{{@ img.altText }} -
-

{{@ img.ttl }}

-

{{@ img.dsc }}

-

{{@ img.crdt }}

diff --git a/lib/v2/newmuseum/exhibitions.js b/lib/v2/newmuseum/exhibitions.js deleted file mode 100644 index 7798526cc883c0..00000000000000 --- a/lib/v2/newmuseum/exhibitions.js +++ /dev/null @@ -1,27 +0,0 @@ -const buildData = require('@/utils/common-config'); - -module.exports = async (ctx) => { - let link; - const state = ctx.query.state; - - switch (state) { - case undefined: - case 'current': - link = 'https://www.newmuseum.org/exhibitions/'; - break; - default: - link = `https://www.newmuseum.org/exhibitions/${state}`; - } - - ctx.state.data = await buildData({ - link, - url: link, - title: 'New Museum - Exhibitions', - item: { - item: '.exh', - title: `$('.exh .title').text()`, - link: `$('.exh > a').attr('href')`, - description: `$('.exh .body-reveal').text()`, - }, - }); -}; diff --git a/lib/v2/newmuseum/maintainer.js b/lib/v2/newmuseum/maintainer.js deleted file mode 100644 index 2b582f7fce773b..00000000000000 --- a/lib/v2/newmuseum/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/exhibitions': ['chazeon'], -}; diff --git a/lib/v2/newmuseum/radar.js b/lib/v2/newmuseum/radar.js deleted file mode 100644 index 483b923139b570..00000000000000 --- a/lib/v2/newmuseum/radar.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - 'newmuseum.org': { - _name: 'New Museum', - www: [ - { - title: 'Exhibitions', - docs: 'https://docs.rsshub.app/en/travel.html#new-museum', - }, - ], - }, -}; diff --git a/lib/v2/newmuseum/router.js b/lib/v2/newmuseum/router.js deleted file mode 100644 index d98b7c8845a250..00000000000000 --- a/lib/v2/newmuseum/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/exhibitions', require('./exhibitions')); -}; diff --git a/lib/v2/npm/maintainer.js b/lib/v2/npm/maintainer.js deleted file mode 100644 index c1ee34952e2625..00000000000000 --- a/lib/v2/npm/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/package/:name': ['Fatpandac'], -}; diff --git a/lib/v2/npm/package.js b/lib/v2/npm/package.js deleted file mode 100644 index 698f45fd559354..00000000000000 --- a/lib/v2/npm/package.js +++ /dev/null @@ -1,45 +0,0 @@ -const got = require('@/utils/got'); -const { art } = require('@/utils/render'); -const path = require('path'); - -module.exports = async (ctx) => { - const name = ctx.params.name; - const packageDownloadLastMonthAPI = `https://api.npmjs.org/downloads/point/last-month/${name}`; // 按月统计 - const packageDownloadLastWeekAPI = `https://api.npmjs.org/downloads/point/last-week/${name}`; // 按周统计 - const packageDownloadLastDayAPI = `https://api.npmjs.org/downloads/point/last-day/${name}`; // 按天统计 - const packageVersionAPI = `https://registry.npmjs.org/${name}`; // 包基本信息 - - const downloadCountLastMonthRes = await got(packageDownloadLastMonthAPI).json(); - const downloadCountLastWeekRes = await got(packageDownloadLastWeekAPI).json(); - const downloadCountLastDayRes = await got(packageDownloadLastDayAPI).json(); - const packageVersionRes = await got(packageVersionAPI).json(); - - const packageVersion = packageVersionRes.time; - const packageVersionList = []; - for (const key in packageVersion) { - packageVersionList.push({ - version: key, - time: packageVersion[key], - }); - } - packageVersionList.reverse(); - - ctx.state.data = { - title: `${name} - npm`, - link: `https://www.npmjs.com/package/${name}`, - description: `${name} - npm`, - item: [ - { - title: `${name} - npm`, - description: art(path.join(__dirname, 'templates/package.art'), { - packageDownloadCountLastMonth: downloadCountLastMonthRes.downloads, - packageDownloadCountLastWeek: downloadCountLastWeekRes.downloads, - packageDownloadCountLastDay: downloadCountLastDayRes.downloads, - packageVersion: packageVersionList, - }), - link: `https://www.npmjs.com/package/${name}`, - guid: `https://www.npmjs.com/package/${name}${packageVersion.modified}`, - }, - ], - }; -}; diff --git a/lib/v2/npm/radar.js b/lib/v2/npm/radar.js deleted file mode 100644 index b02f83dbdcadf1..00000000000000 --- a/lib/v2/npm/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'npmjs.com': { - _name: 'npm', - '.': [ - { - title: '包', - docs: 'https://docs.rsshub.app/program-update.html#npm', - source: ['/package/:name'], - target: '/npm/package/:name', - }, - ], - }, -}; diff --git a/lib/v2/npm/router.js b/lib/v2/npm/router.js deleted file mode 100644 index 89fd149fb5003d..00000000000000 --- a/lib/v2/npm/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/package/:name', require('./package')); -}; diff --git a/lib/v2/npm/templates/package.art b/lib/v2/npm/templates/package.art deleted file mode 100644 index db7b75a365e739..00000000000000 --- a/lib/v2/npm/templates/package.art +++ /dev/null @@ -1,10 +0,0 @@ -

Download

-

Last Day: {{packageDownloadCountLastDay}}

-

Last week: {{packageDownloadCountLastWeek}}

-

Last month: {{packageDownloadCountLastMonth}}

-
-

Version

-{{ each packageVersion}} -

{{$value.version}}: {{$value.time}}

-{{/each}} - diff --git a/lib/v2/picuki/profile.js b/lib/v2/picuki/profile.js index a117876611f3ab..89a5a812a895b1 100644 --- a/lib/v2/picuki/profile.js +++ b/lib/v2/picuki/profile.js @@ -3,7 +3,6 @@ const cheerio = require('cheerio'); const chrono = require('chrono-node'); const { art } = require('@/utils/render'); const path = require('path'); -const config = require('@/config').value; module.exports = async (ctx) => { const id = ctx.params.id; @@ -12,16 +11,8 @@ module.exports = async (ctx) => { const profileUrl = `https://www.picuki.com/profile/${id}`; - const data = await ctx.cache.tryGet( - profileUrl, - async () => { - const _r = await got(profileUrl); - return _r.data; - }, - config.cache.routeExpire, - false - ); - const $ = cheerio.load(data); + const response = await got.get(profileUrl); + const $ = cheerio.load(response.data); const profileName = $('.profile-name-bottom').text(); const profileImg = $('.profile-avatar > img').attr('src'); @@ -31,7 +22,7 @@ module.exports = async (ctx) => { async function getMedia(url) { const getPost = async () => { - const response = await got(url, { + const response = await got.get(url, { headers: { Referer: profileUrl, }, diff --git a/lib/v2/pubmed/maintainer.js b/lib/v2/pubmed/maintainer.js deleted file mode 100644 index 521275e35a5434..00000000000000 --- a/lib/v2/pubmed/maintainer.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/trending/:filters?': ['nczitzk'], -}; diff --git a/lib/v2/pubmed/radar.js b/lib/v2/pubmed/radar.js deleted file mode 100644 index 9140945c18188c..00000000000000 --- a/lib/v2/pubmed/radar.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - 'pubmed.ncbi.nlm.nih.gov': { - _name: 'PubMed', - '.': [ - { - title: 'Trending articles', - docs: 'https://docs.rsshub.app/journal.html#pubmed-trending-articles', - source: ['/trending', '/'], - target: (params, url) => `/pubmed/trending/${new URL(url).searchParams.getAll('filter').join(',')}`, - }, - ], - }, -}; diff --git a/lib/v2/pubmed/router.js b/lib/v2/pubmed/router.js deleted file mode 100644 index 5db58ad1e58f6c..00000000000000 --- a/lib/v2/pubmed/router.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function (router) { - router.get('/trending/:filters?', require('./trending')); -}; diff --git a/lib/v2/pubmed/templates/description.art b/lib/v2/pubmed/templates/description.art deleted file mode 100644 index c4b8e232b99721..00000000000000 --- a/lib/v2/pubmed/templates/description.art +++ /dev/null @@ -1,7 +0,0 @@ -{{ if authors }} -{{@ authors }} -{{ /if}} -
-{{ if abs }} -{{@ abs }} -{{ /if}} \ No newline at end of file diff --git a/lib/v2/pubmed/trending.js b/lib/v2/pubmed/trending.js deleted file mode 100644 index 3e761efd7df99d..00000000000000 --- a/lib/v2/pubmed/trending.js +++ /dev/null @@ -1,58 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); - -module.exports = async (ctx) => { - const filters = ctx.params.filters; - - const rootUrl = 'https://pubmed.ncbi.nlm.nih.gov'; - const currentUrl = `${rootUrl}/trending${filters ? `?filter=${filters.replace(/,/g, '&filter=')}` : ''}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - let items = $('a[data-article-id]') - .toArray() - .map((item) => { - item = $(item); - - return { - title: item.text(), - link: `${rootUrl}/${item.attr('data-article-id')}`, - }; - }); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - item.doi = content('meta[name="citation_doi"]').attr('content'); - item.pubDate = parseDate(content('meta[name="citation_date"]').attr('content')); - item.description = art(path.join(__dirname, 'templates/description.art'), { - authors: content('.authors-list').html(), - abs: content('#enc-abstract').html(), - }); - - return item; - }) - ) - ); - - ctx.state.data = { - title: 'Trending page - PubMed', - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/quicker/maintainer.js b/lib/v2/quicker/maintainer.js deleted file mode 100644 index d5e7b8dd533d36..00000000000000 --- a/lib/v2/quicker/maintainer.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - '/qa/:category?/:state?': ['Cesaryuan', 'nczitzk'], - '/share/:category?': ['nczitzk'], - '/update': ['Cesaryuan', 'nczitzk'], - '/user/:category/:id': ['Cesaryuan', 'nczitzk'], - '/versions': ['Cesaryuan', 'nczitzk'], -}; diff --git a/lib/v2/quicker/qa.js b/lib/v2/quicker/qa.js deleted file mode 100644 index 1fd2037920a8fb..00000000000000 --- a/lib/v2/quicker/qa.js +++ /dev/null @@ -1,65 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const category = ctx.params.category ?? 'all'; - const state = ctx.params.state ?? ''; - - const rootUrl = 'https://getquicker.net'; - const currentUrl = `${rootUrl}/QA${category !== 'all' ? `?category=${category}` : ''}${state ? `?state=${state}` : ''}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - let items = $('a.question-title') - .slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 25) - .toArray() - .map((item) => { - item = $(item); - - return { - title: item.text(), - link: `${rootUrl}${item.attr('href')}`, - }; - }); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - content('div[data-note="最后更新人信息"]').remove(); - - const pubDate = content('.info-text') - .first() - .text() - .replace(/创建于 /, '') - .trim(); - - item.description = content('.topic-body').html(); - item.author = content('.user-link').first().text(); - item.pubDate = timezone(/-/.test(pubDate) ? parseDate(pubDate) : parseRelativeDate(pubDate), +8); - - return item; - }) - ) - ); - - ctx.state.data = { - title: $('title').text(), - link: currentUrl, - item: items, - allowEmpty: true, - }; -}; diff --git a/lib/v2/quicker/radar.js b/lib/v2/quicker/radar.js deleted file mode 100644 index 6333917e396d34..00000000000000 --- a/lib/v2/quicker/radar.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = { - 'getquicker.net': { - _name: 'Quicker', - '.': [ - { - title: '动作分享', - docs: 'https://docs.rsshub.app/programming.html#quicker-dong-zuo-fen-xiang', - source: ['/Share/:category', '/'], - target: '/quicker/share/:category?', - }, - { - title: '讨论区', - docs: 'https://docs.rsshub.app/programming.html#quicker-tao-lun-qu', - source: ['/QA', '/'], - target: (params, url) => `/quicker/qa/${new URL(url).searchParams.get('category') ?? ''}/${new URL(url).searchParams.get('state') ?? ''}`, - }, - { - title: '用户动作更新', - docs: 'https://docs.rsshub.app/programming.html#quicker-yong-hu-dong-zuo-geng-xin', - source: ['/QA', '/'], - target: (params, url) => `/quicker/qa/${new URL(url).searchParams.get('category') ?? ''}/${new URL(url).searchParams.get('state') ?? ''}`, - }, - { - title: '版本更新', - docs: 'https://docs.rsshub.app/programming.html#quicker-ban-ben-geng-xin', - source: ['/Help/Versions', '/'], - target: '/quicker/versions', - }, - ], - }, -}; diff --git a/lib/v2/quicker/router.js b/lib/v2/quicker/router.js deleted file mode 100644 index 6415b5e41cca66..00000000000000 --- a/lib/v2/quicker/router.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = function (router) { - router.get('/qa/:category?/:state?', require('./qa')); - router.get('/share/:category?', require('./share')); - router.get('/update', require('./versions')); - router.get('/user/:category/:id', require('./user')); - router.get('/versions', require('./versions')); -}; diff --git a/lib/v2/quicker/share.js b/lib/v2/quicker/share.js deleted file mode 100644 index d17cb5c320cbce..00000000000000 --- a/lib/v2/quicker/share.js +++ /dev/null @@ -1,61 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const category = ctx.params.category ?? 'Recent'; - - const rootUrl = 'https://getquicker.net'; - const currentUrl = `${rootUrl}/Share/${category}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - let items = $('table tbody tr') - .slice(1, ctx.query.limit ? parseInt(ctx.query.limit) : 25) - .toArray() - .map((item) => { - item = $(item).find('td a').first(); - - return { - title: item.text(), - link: `${rootUrl}${item.attr('href')}`, - }; - }); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - content('section').last().remove(); - content('#app').children().slice(0, 2).remove(); - - const pubDate = content('.text-secondary a').not('.text-secondary').first().text()?.trim().replace(/\s*/g, '') || content('div.note-text').find('span').eq(3).text(); - - item.author = content('.user-link').first().text(); - item.description = content('div[data-info="动作信息"]').html() ?? content('#app').html() ?? content('.row').eq(1).html(); - item.pubDate = timezone(/-/.test(pubDate) ? parseDate(pubDate) : parseRelativeDate(pubDate), +8); - - return item; - }) - ) - ); - - ctx.state.data = { - title: $('title').text(), - link: currentUrl, - item: items, - allowEmpty: true, - }; -}; diff --git a/lib/v2/quicker/user.js b/lib/v2/quicker/user.js deleted file mode 100644 index cdd64c19f90dd6..00000000000000 --- a/lib/v2/quicker/user.js +++ /dev/null @@ -1,62 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const timezone = require('@/utils/timezone'); -const { parseDate, parseRelativeDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const category = ctx.params.category; - const id = ctx.params.id; - - const rootUrl = 'https://getquicker.net'; - const currentUrl = `${rootUrl}/User/${category}/${id}`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - let items = $('table tbody tr') - .slice(1, ctx.query.limit ? parseInt(ctx.query.limit) : 25) - .toArray() - .map((item) => { - item = $(item).find('td a').first(); - - return { - title: item.text(), - link: `${rootUrl}${item.attr('href')}`, - }; - }); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - }); - - const content = cheerio.load(detailResponse.data); - - content('section').last().remove(); - content('#app').children().slice(0, 2).remove(); - - const pubDate = content('.text-secondary a').not('.text-secondary').first().text()?.trim().replace(/\s*/g, '') || content('div.note-text').find('span').eq(3).text(); - - item.author = content('.user-link').first().text(); - item.description = content('div[data-info="动作信息"]').html() ?? content('#app').html() ?? content('.row').eq(1).html(); - item.pubDate = timezone(/-/.test(pubDate) ? parseDate(pubDate) : parseRelativeDate(pubDate), +8); - - return item; - }) - ) - ); - - ctx.state.data = { - title: $('title').text(), - link: currentUrl, - item: items, - allowEmpty: true, - }; -}; diff --git a/lib/v2/quicker/versions.js b/lib/v2/quicker/versions.js deleted file mode 100644 index ece5f7a0e3ca3e..00000000000000 --- a/lib/v2/quicker/versions.js +++ /dev/null @@ -1,36 +0,0 @@ -const got = require('@/utils/got'); -const cheerio = require('cheerio'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const rootUrl = 'https://getquicker.net'; - const currentUrl = `${rootUrl}/Help/Versions`; - - const response = await got({ - method: 'get', - url: currentUrl, - }); - - const $ = cheerio.load(response.data); - - const items = $('.version') - .toArray() - .map((item) => { - item = $(item); - - const a = item.find('h2 a'); - - return { - title: a.text().trim(), - link: `${rootUrl}${a.attr('href')}`, - description: item.find('.article-content').html(), - pubDate: parseDate(item.find('.text-secondary').first().text()), - }; - }); - - ctx.state.data = { - title: $('title').text(), - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/qweather/3days.js b/lib/v2/qweather/3days.js deleted file mode 100644 index 544cc9f3a1b567..00000000000000 --- a/lib/v2/qweather/3days.js +++ /dev/null @@ -1,46 +0,0 @@ -const got = require('@/utils/got'); -const { art } = require('@/utils/render'); -const path = require('path'); -const config = require('@/config').value; -const rootUrl = 'https://devapi.qweather.com/v7/weather/3d?'; - -module.exports = async (ctx) => { - const id = await ctx.cache.tryGet(ctx.params.location + '_id', async () => { - const response = await got(`https://geoapi.qweather.com/v2/city/lookup?location=${ctx.params.location}&key=${config.hefeng.key}`); - const data = []; - for (const i in response.data.location) { - data.push(response.data.location[i]); - } - return data[0].id; - }); - const requestUrl = rootUrl + 'key=' + config.hefeng.key + '&location=' + id; - const responseData = await ctx.cache.tryGet( - ctx.params.location, - async () => { - const response = await got(requestUrl); - return response.data; - }, - config.cache.contentExpire, - false - ); - const data = []; - for (const i in responseData.daily) { - data.push(responseData.daily[i]); - } - const items = data.map((item) => ({ - title: '预报日期:' + item.fxDate, - description: art(path.join(__dirname, './util/3days.art'), { - item, - }), - pubDate: responseData.updateTime, - guid: '位置:' + ctx.params.location + '--日期:' + item.fxDate, - link: responseData.fxLink, - })); - - ctx.state.data = { - title: ctx.params.location + '未来三天天气', - description: ctx.params.location + '未来三天天气情况,使用和风彩云api', - item: items, - link: responseData.fxLink, - }; -}; diff --git a/lib/v2/qweather/maintainer.js b/lib/v2/qweather/maintainer.js deleted file mode 100644 index 907904212644f0..00000000000000 --- a/lib/v2/qweather/maintainer.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - '/qweather/3days/:location': ['Rein-Ou'], - '/qweather/now/:location': ['Rein-Ou'], -}; diff --git a/lib/v2/qweather/now.js b/lib/v2/qweather/now.js deleted file mode 100644 index 7e179c4b48f613..00000000000000 --- a/lib/v2/qweather/now.js +++ /dev/null @@ -1,46 +0,0 @@ -const got = require('@/utils/got'); -const { art } = require('@/utils/render'); -const path = require('path'); -const { parseDate } = require('@/utils/parse-date'); -const timezone = require('@/utils/timezone'); -const config = require('@/config').value; -const rootUrl = 'https://devapi.qweather.com/v7/weather/now?'; -module.exports = async (ctx) => { - const id = await ctx.cache.tryGet(ctx.params.location + '_id', async () => { - const response = await got(`https://geoapi.qweather.com/v2/city/lookup?location=${ctx.params.location}&key=${config.hefeng.key}`); - const data = []; - for (const i in response.data.location) { - data.push(response.data.location[i]); - } - return data[0].id; - }); - const requestUrl = rootUrl + 'key=' + config.hefeng.key + '&location=' + id; - const responseData = await ctx.cache.tryGet( - ctx.params.location + '_now', - async () => { - const response = await got(requestUrl); - return response.data; - }, - 3600, // second - false - ); - - const data = [responseData.now]; - - const timeObj = timezone(parseDate(responseData.updateTime), +8); - - const time_show = timeObj.toLocaleString(); - - ctx.state.data = { - title: ctx.params.location + '实时天气', - description: ctx.params.location + '实时天气状况', - item: data.map((item) => ({ - title: '观测时间:' + time_show, - description: art(path.join(__dirname, './util/now.art'), { item }), - pubDate: timeObj, - guid: '位置:' + ctx.params.location + '--时间:' + time_show, - link: responseData.fxLink, - })), - link: responseData.fxLink, - }; -}; diff --git a/lib/v2/qweather/router.js b/lib/v2/qweather/router.js deleted file mode 100644 index 63c591437cbccb..00000000000000 --- a/lib/v2/qweather/router.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = function (router) { - router.get('/3days/:location', require('./3days')); - router.get('/now/:location', require('./now')); -}; diff --git a/lib/v2/qweather/util/3days.art b/lib/v2/qweather/util/3days.art deleted file mode 100644 index 5d97c1d928a388..00000000000000 --- a/lib/v2/qweather/util/3days.art +++ /dev/null @@ -1,20 +0,0 @@ -白天:{{item.textDay}}——夜间:{{item.textNight}} -
-气温:{{item.tempMin}}℃~{{item.tempMax}}℃ -
-相对湿度:{{item.humidity}}% -
-大气压强:{{item.pressure}}百帕 -
-紫外线强度:{{item.uvIndex}} -
-白天风向:{{item.windDirDay}} 风力:{{item.windScaleDay}}级 风速:{{item.windSpeedDay}}公里/小时 -
-夜间风向:{{item.windDirNight}} 风力:{{item.windScaleNight}}级 风速:{{item.windSpeedNight}}公里/小时 -
-能见度:{{item.vis}}公里 -
-日出:{{item.sunrise}} 日落: {{item.sunset}} -
-月相:{{item.moonPhase}} 月出:{{item.sunrise}} 月落:{{item.moonset}} -
\ No newline at end of file diff --git a/lib/v2/qweather/util/now.art b/lib/v2/qweather/util/now.art deleted file mode 100644 index dfdbdf7e03a701..00000000000000 --- a/lib/v2/qweather/util/now.art +++ /dev/null @@ -1,16 +0,0 @@ -天气:{{item.text}} -
-气温:{{item.temp}}℃ -
-体感温度:{{item.feelsLike}}℃ -
-风向:{{item.windDir}} -
-风力:{{item.windScale}}级 风速:{{item.windSpeed}}km/h -
-湿度:{{item.humidity}}% 大气压强:{{item.pressure}}hPa -
-本小时降水量:{{item.precip}}mm -
-能见度:{{item.vis}}km -
\ No newline at end of file diff --git a/lib/v2/telegram/channel.js b/lib/v2/telegram/channel.js index 618049cad743d2..49801e5548bca3 100644 --- a/lib/v2/telegram/channel.js +++ b/lib/v2/telegram/channel.js @@ -82,16 +82,12 @@ module.exports = async (ctx) => { const resourceUrl = searchQuery ? `https://t.me/s/${username}?q=${encodeURIComponent(searchQuery)}` : `https://t.me/s/${username}`; - const data = await ctx.cache.tryGet( - resourceUrl, - async () => { - const _r = await got(resourceUrl); - return _r.data; - }, - config.cache.routeExpire, - false - ); - + let data = await ctx.cache.get(resourceUrl, false); + if (!data) { + const response = await got.get(resourceUrl); + data = response.data; + ctx.cache.set(resourceUrl, data, config.cache.routeExpire); + } const $ = cheerio.load(data); const list = includeServiceMsg ? $('.tgme_widget_message_wrap:not(.tgme_widget_message_wrap:has(.tme_no_messages_found))') // exclude 'no posts found' messages diff --git a/lib/v2/test/index.js b/lib/v2/test/index.js index dc3396bcd4957e..de003ee3cc96f9 100644 --- a/lib/v2/test/index.js +++ b/lib/v2/test/index.js @@ -62,7 +62,7 @@ module.exports = async (ctx) => { } if (!noRefresh) { noRefresh = '0'; - await ctx.cache.set('noRefreshCache', '1', undefined); + await ctx.cache.set('noRefreshCache', '1', undefined, false); } item.push({ title: 'Cache Title', diff --git a/lib/v2/thepaper/factpaper.js b/lib/v2/thepaper/factpaper.js deleted file mode 100644 index 23158b8a6a630d..00000000000000 --- a/lib/v2/thepaper/factpaper.js +++ /dev/null @@ -1,61 +0,0 @@ -const got = require('@/utils/got'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); -const { art } = require('@/utils/render'); -const path = require('path'); - -module.exports = async (ctx) => { - const status = parseInt(ctx.params.status ?? '1'); - - const rootUrl = 'https://www.factpaper.cn'; - const apiRootUrl = 'https://api.factpaper.cn'; - const currentUrl = `${apiRootUrl}/fact-check/front/proveList`; - - const response = await got({ - method: 'post', - url: currentUrl, - json: { - pageNum: 1, - pageSize: 20, - status, - }, - }); - - let items = response.data.data.list.map((item) => ({ - title: item.title, - guid: item.proveId, - link: `${rootUrl}/detail?id=${item.proveId}`, - pubDate: timezone(parseDate(item.publishTime), +8), - })); - - items = await Promise.all( - items.map((item) => - ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'post', - url: `${apiRootUrl}/fact-check/front/proveInfo`, - json: { - proveId: item.guid, - }, - }); - - const data = detailResponse.data.data; - - item.author = data.userName; - item.description = art(path.join(__dirname, 'templates/factpaper.art'), { - content: data.content, - checkinfo: data.checkInfoList, - finalCheckInfo: data.finalCheckInfo, - }); - - return item; - }) - ) - ); - - ctx.state.data = { - title: `澎湃明查 - ${status === 1 ? '有定论' : '核查中'}`, - link: rootUrl, - item: items, - }; -}; diff --git a/lib/v2/thepaper/maintainer.js b/lib/v2/thepaper/maintainer.js deleted file mode 100644 index b348757802e01c..00000000000000 --- a/lib/v2/thepaper/maintainer.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - '/839studio/:id': ['umm233'], - '/839studio': ['umm233'], - '/channel/:id': ['xyqfer', 'nczitzk'], - '/featured': ['HenryQW', 'nczitzk'], - '/factpaper/:status?': ['nczitzk'], - '/list/:id': ['nczitzk'], -}; diff --git a/lib/v2/thepaper/radar.js b/lib/v2/thepaper/radar.js deleted file mode 100644 index 42cf1c2c2b5737..00000000000000 --- a/lib/v2/thepaper/radar.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = { - 'thepaper.cn': { - _name: '澎湃新闻', - '.': [ - { - title: '首页头条', - docs: 'https://docs.rsshub.app/traditional-media.html#peng-pai-xin-wen-shou-ye-tou-tiao', - source: ['/'], - target: '/thepaper/featured', - }, - { - title: '频道', - docs: 'https://docs.rsshub.app/traditional-media.html#peng-pai-xin-wen-pin-dao', - source: ['/'], - target: (params, url) => `/thepaper/channel/${new URL(url).search(/channel_(\d+)/)}`, - }, - { - title: '列表', - docs: 'https://docs.rsshub.app/traditional-media.html#peng-pai-xin-wen-lie-biao', - source: ['/'], - target: (params, url) => `/thepaper/channel/${new URL(url).search(/list_(\d+)/)}`, - }, - { - title: '澎湃美数组作品集', - docs: 'https://docs.rsshub.app/traditional-media.html#peng-pai-xin-wen-peng-pai-mei-shu-zuo-pin-ji', - source: ['/'], - target: '/thepaper/839studio/:id', - }, - ], - }, - 'factpaper.cn': { - _name: '澎湃新闻', - '.': [ - { - title: '明查', - docs: 'https://docs.rsshub.app/traditional-media.html#peng-pai-xin-wen-ming-cha', - source: ['/'], - target: '/thepaper/factpaper/:status', - }, - ], - }, -}; diff --git a/lib/v2/thepaper/router.js b/lib/v2/thepaper/router.js deleted file mode 100644 index be6f7685d0c871..00000000000000 --- a/lib/v2/thepaper/router.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = function (router) { - router.get('/839studio', require('./839studio/studio')); - router.get('/839studio/:id', require('./839studio/category')); - router.get('/channel/:id', require('./channel')); - router.get('/featured', require('./featured')); - router.get('/factpaper/:status?', require('./factpaper')); - router.get('/list/:id', require('./list')); -}; diff --git a/lib/v2/thepaper/templates/factpaper.art b/lib/v2/thepaper/templates/factpaper.art deleted file mode 100644 index c78a15da3e754e..00000000000000 --- a/lib/v2/thepaper/templates/factpaper.art +++ /dev/null @@ -1,12 +0,0 @@ -

发起求证

-{{@ content }} -{{if checkinfo}} -

一起核查

-{{each checkinfo check}} -{{@ check.content }} -{{/each}} -{{/if}} -{{if finalCheckInfo}} -

有定论了

-{{@ finalCheckInfo.content }} -{{/if}} \ No newline at end of file diff --git a/lib/v2/thepaper/utils.js b/lib/v2/thepaper/utils.js deleted file mode 100644 index 29850b5827e32c..00000000000000 --- a/lib/v2/thepaper/utils.js +++ /dev/null @@ -1,55 +0,0 @@ -const cheerio = require('cheerio'); -const date = require('@/utils/date'); -const { parseDate } = require('@/utils/parse-date'); -const timezone = require('@/utils/timezone'); -const got = require('@/utils/got'); - -module.exports = { - ProcessFeed: async (query, link, ctx) => { - const res = await got(link); - - const $ = cheerio.load(res.data); - const list = $(query).slice(0, 10).get(); - - return Promise.all( - list.map((item) => { - const $ = cheerio.load(item); - const itemUrl = `https://m.thepaper.cn/${$(item).find('a').eq(0).attr('href')}`; - return ctx.cache.tryGet(itemUrl, async () => { - const res = await got(itemUrl); - const content = cheerio.load(res.data); - - let description, pubDate; - - if (content('div.news_video_msg').length > 0) { - description = content('#vdetail_sum').html(); - pubDate = timezone( - parseDate( - content('div.news_video_msg') - .html() - .replace(/ /gi, '') - .split('
')[0] - ), - +8 - ); - } else if (content('#slider_wrapper_ul').length > 0) { - description = ''; - pubDate = new Date(date($(item).find('div.list_item_extra span').eq(1).text())).toUTCString(); - } else { - description = content('div.newsdetail_content').html(); - pubDate = timezone(parseDate(content('div.date').text().trim().split('来源:')[0].trim()), +8); - } - - const single = { - title: content('title').text(), - link: itemUrl, - description, - pubDate, - author: content('div.author').text(), - }; - return single; - }); - }) - ); - }, -}; diff --git a/lib/v2/zooTeam/blog.js b/lib/v2/zooTeam/blog.js deleted file mode 100644 index bbfe71ad4b1939..00000000000000 --- a/lib/v2/zooTeam/blog.js +++ /dev/null @@ -1,32 +0,0 @@ -const got = require('@/utils/got'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const response = await got({ - method: 'get', - url: 'https://www.zoo.team/api/articles', - }); - const data = response.data.data.articles; - ctx.state.data = { - // 源标题 - title: '政采云前端博客', - // 源链接 - link: 'https://www.zoo.team', - // 源说明 - description: '政采云前端博客', - // 遍历此前获取的数据 - item: data.map((item) => ({ - // 文章标题 - title: item.title, - // 文章正文 - description: `${item.desc}
`, - // 文章发布时间 - pubDate: timezone(parseDate(item.created_at), +8), - // 文章链接 - link: `https://zoo.team/article/${item.path}`, - // 分类 - category: item.category, - })), - }; -}; diff --git a/lib/v2/zooTeam/maintainer.js b/lib/v2/zooTeam/maintainer.js deleted file mode 100644 index 358e9170aa3a0f..00000000000000 --- a/lib/v2/zooTeam/maintainer.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - '/zooTeam/blog': ['Pulset'], - '/zooTeam/weekly': ['Pulset'], -}; diff --git a/lib/v2/zooTeam/radar.js b/lib/v2/zooTeam/radar.js deleted file mode 100644 index d42ae0febe6cb2..00000000000000 --- a/lib/v2/zooTeam/radar.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - 'zoo.team': { - _name: '政采云前端技术团队', - weekly: [ - { - title: '小报', - docs: 'https://docs.rsshub.app/blog.html#zheng-cai-yun-qian-duan-ji-shu-tuan-dui', - source: '/', - target: '/zooTeam/weekly', - }, - ], - www: [ - { - title: '博客', - docs: 'https://docs.rsshub.app/blog.html#zheng-cai-yun-qian-duan-ji-shu-tuan-dui', - source: '/', - target: '/zooTeam/blog', - }, - ], - }, -}; diff --git a/lib/v2/zooTeam/router.js b/lib/v2/zooTeam/router.js deleted file mode 100644 index 75a52c6e8f6675..00000000000000 --- a/lib/v2/zooTeam/router.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = function (router) { - router.get('/blog', require('./blog')); - router.get('/weekly', require('./weekly')); -}; diff --git a/lib/v2/zooTeam/weekly.js b/lib/v2/zooTeam/weekly.js deleted file mode 100644 index ba651aeaf74b80..00000000000000 --- a/lib/v2/zooTeam/weekly.js +++ /dev/null @@ -1,34 +0,0 @@ -const got = require('@/utils/got'); -const timezone = require('@/utils/timezone'); -const { parseDate } = require('@/utils/parse-date'); - -module.exports = async (ctx) => { - const response = await got({ - method: 'get', - url: 'https://weekly.zoo.team:3030/api/lastest/list', - }); - const data = response.data.data; - ctx.state.data = { - // 源标题 - title: '政采云前端小报', - // 源链接 - link: 'https://weekly.zoo.team/', - // 源说明 - description: '政采云前端小报', - // 有可能接口返回为空 - allowEmpty: true, - // 遍历此前获取的数据 - item: data.map((item) => ({ - // 文章标题 - title: item.title, - // 文章正文 - description: item.description, - // 文章发布时间 - pubDate: timezone(parseDate(item.timestamp * 1000), +8), - // 文章链接 - link: item.link, - // 分类 - category: item.category, - })), - }; -}; diff --git a/lib/views/atom.art b/lib/views/atom.art index b0a754795d0081..ee0addb78e2c44 100644 --- a/lib/views/atom.art +++ b/lib/views/atom.art @@ -37,10 +37,8 @@ {{ $e.guid || $e.id || $e.link }} <![CDATA[{{@ $e.title }}]]> - {{ if ($e.pubDate && $e.updated) }} - {{ $e.pubDate }} - {{ /if }} - {{ $e.updated || $e.pubDate }} + {{ $e.pubDate || $e.updated }} + {{ $e.updated }} {{ if $e.author }} diff --git a/package.json b/package.json index dc980421cf6962..042b9f2285f1bb 100644 --- a/package.json +++ b/package.json @@ -48,10 +48,9 @@ "@vuepress/plugin-back-to-top": "1.9.7", "@vuepress/plugin-google-analytics": "1.9.7", "@vuepress/plugin-pwa": "1.9.7", - "@vuepress/shared-utils": "1.9.7", "ci-info": "3.3.0", "cross-env": "7.0.3", - "eslint": "8.12.0", + "eslint": "8.11.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-prettier": "4.0.0", "eslint-plugin-yml": "0.14.0", @@ -60,7 +59,7 @@ "mockdate": "3.0.5", "nock": "13.2.4", "nodemon": "2.0.15", - "prettier": "2.6.1", + "prettier": "2.6.0", "prettier-check": "2.0.0", "pretty-quick": "3.1.3", "remark": "13.0.0", @@ -79,7 +78,7 @@ "dependencies": { "@koa/router": "10.1.1", "@postlight/mercury-parser": "2.2.1", - "@sentry/node": "6.19.3", + "@sentry/node": "6.19.2", "aes-js": "3.1.2", "art-template": "4.13.2", "bbcodejs": "0.0.4", @@ -95,12 +94,12 @@ "etag": "1.8.1", "fanfou-sdk": "4.2.0", "git-rev-sync": "3.0.2", - "googleapis": "100.0.0", + "googleapis": "98.0.0", "got": "11.8.3", "https-proxy-agent": "5.0.0", "iconv-lite": "0.6.3", "instagram-private-api": "1.45.3", - "ioredis": "5.0.3", + "ioredis": "4.28.5", "ip": "*", "ip-regex": "4.3.0", "is-localhost-ip": "1.4.0", @@ -111,15 +110,15 @@ "koa-basic-auth": "4.0.0", "koa-favicon": "2.1.0", "koa-mount": "4.0.0", - "lru-cache": "7.7.3", + "lru-cache": "7.7.1", "lz-string": "1.4.4", "mailparser": "3.4.0", "markdown-it": "12.3.2", "module-alias": "2.2.2", - "parse-torrent": "9.1.5", + "parse-torrent": "9.1.4", "pidusage": "3.0.0", "plist": "3.0.5", - "puppeteer": "13.5.2", + "puppeteer": "13.5.1", "query-string": "7.1.1", "require-all": "3.0.0", "rss-parser": "3.12.0", @@ -159,8 +158,5 @@ }, "nodemonConfig": { "ext": "art,js,mjs,json" - }, - "engines": { - "node": ">=14" } } diff --git a/test/middleware/template.js b/test/middleware/template.js index 89b8c90c061a6d..4b31e96fff06ba 100644 --- a/test/middleware/template.js +++ b/test/middleware/template.js @@ -10,8 +10,6 @@ afterAll(() => { }); describe('template', () => { - const expectPubDate = new Date(1546272000000 - 10 * 1000); - it(`.rss`, async () => { const response1 = await request.get('/test/1.rss'); const parsed1 = await parser.parseString(response1.text); @@ -27,7 +25,7 @@ describe('template', () => { expect(parsed1.items[0]).toEqual(expect.any(Object)); expect(parsed1.items[0].title).toEqual(expect.any(String)); expect(parsed1.items[0].link).toEqual(expect.any(String)); - expect(parsed1.items[0].pubDate).toBe(expectPubDate.toUTCString()); + expect(parsed1.items[0].pubDate).toEqual(expect.any(String)); expect(parsed1.items[0].author).toEqual(expect.any(String)); expect(parsed1.items[0].content).toEqual(expect.any(String)); expect(parsed1.items[0].guid).toEqual(expect.any(String)); @@ -56,7 +54,7 @@ describe('template', () => { expect(parsed.items[0]).toEqual(expect.any(Object)); expect(parsed.items[0].title).toEqual(expect.any(String)); expect(parsed.items[0].link).toEqual(expect.any(String)); - expect(parsed.items[0].pubDate).toBe(expectPubDate.toISOString()); + expect(parsed.items[0].pubDate).toEqual(expect.any(String)); expect(parsed.items[0].author).toEqual(expect.any(String)); expect(parsed.items[0].content).toEqual(expect.any(String)); expect(parsed.items[0].id).toEqual(expect.any(String)); diff --git a/test/utils/common-utils.js b/test/utils/common-utils.js index e895a485653325..d0306193c55fb1 100644 --- a/test/utils/common-utils.js +++ b/test/utils/common-utils.js @@ -4,33 +4,4 @@ describe('common-utils', () => { it('toTitleCase', () => { expect(utils.toTitleCase('RSSHub IS AS aweSOme aS henry')).toBe('Rsshub Is As Awesome As Henry'); }); - - it('convertDateToISO8601', () => { - expect(utils.convertDateToISO8601('')).toBe(''); - expect(utils.convertDateToISO8601(null)).toBe(null); - expect(utils.convertDateToISO8601(undefined)).toBe(undefined); - - const date = new Date('2019-01-01'); - const expected = date.toISOString(); - expect(utils.convertDateToISO8601(date)).toBe(expected); - expect(utils.convertDateToISO8601(date.toISOString())).toBe(expected); - expect(utils.convertDateToISO8601(date.toUTCString())).toBe(expected); - expect(utils.convertDateToISO8601(date.toLocaleString())).toBe(expected); - expect(utils.convertDateToISO8601('Tue, 01 Jan 2019 08:00:00 UTC+8')).toBe(expected); - - expect(utils.convertDateToISO8601('Tue, 01 Jan 2019 00:00:00')).toBe(new Date(date.getTime() + new Date().getTimezoneOffset() * 60 * 1000).toISOString()); - // need to pass a function in order to use `toThrow` - expect(() => { - utils.convertDateToISO8601('something invalid'); - }).toThrow(RangeError); - }); - - it('collapseWhitespace', () => { - expect(utils.collapseWhitespace('')).toBe(''); - expect(utils.collapseWhitespace(null)).toBe(null); - expect(utils.collapseWhitespace(undefined)).toBe(undefined); - expect(utils.collapseWhitespace(' \n\n\n ')).toBe(''); - expect(utils.collapseWhitespace('a string already collapsed')).toBe('a string already collapsed'); - expect(utils.collapseWhitespace(' \n a lot of whitespaces and \n\n\n\n linebreaks \n\n ')).toBe('a lot of whitespaces and linebreaks'); - }); }); diff --git a/test/utils/parse-date.js b/test/utils/parse-date.js deleted file mode 100644 index 87e170ffe257f9..00000000000000 --- a/test/utils/parse-date.js +++ /dev/null @@ -1,154 +0,0 @@ -const { parseRelativeDate } = require('@/utils/parse-date'); -const MockDate = require('mockdate'); - -describe('parseRelativeDate', () => { - const second = 1000; - const minute = 60 * second; - const hour = 60 * minute; - const day = 24 * hour; - const week = 7 * day; - const month = 30 * day; - const year = 365 * day; - - const weekday = (d) => +new Date(date.getFullYear(), date.getMonth(), date.getDate() + d - (date.getDay() > d ? date.getDay() : date.getDay() + 7)); - - const date = new Date(); - - MockDate.set(date); - - it('s秒钟前', () => { - expect(+new Date(parseRelativeDate('10秒前'))).toBe(+date - 10 * second); - }); - - it('m分钟前', () => { - expect(+new Date(parseRelativeDate('10分钟前'))).toBe(+date - 10 * minute); - }); - - it('m分鐘前', () => { - expect(+new Date(parseRelativeDate('10分鐘前'))).toBe(+date - 10 * minute); - }); - - it('m分钟后', () => { - expect(+new Date(parseRelativeDate('10分钟后'))).toBe(+date + 10 * minute); - }); - - it('a minute ago', () => { - expect(+new Date(parseRelativeDate('a minute ago'))).toBe(+date - 1 * minute); - }); - - it('s minutes ago', () => { - expect(+new Date(parseRelativeDate('10 minutes ago'))).toBe(+date - 10 * minute); - }); - - it('s mins ago', () => { - expect(+new Date(parseRelativeDate('10 mins ago'))).toBe(+date - 10 * minute); - }); - - it('in s minutes', () => { - expect(+new Date(parseRelativeDate('in 10 minutes'))).toBe(+date + 10 * minute); - }); - - it('in an hour', () => { - expect(+new Date(parseRelativeDate('in an hour'))).toBe(+date + 1 * hour); - }); - - it('H小时前', () => { - expect(+new Date(parseRelativeDate('10小时前'))).toBe(+date - 10 * hour); - }); - - it('H个小时前', () => { - expect(+new Date(parseRelativeDate('10个小时前'))).toBe(+date - 10 * hour); - }); - - it('D天前', () => { - expect(+new Date(parseRelativeDate('10天前'))).toBe(+date - 10 * day); - }); - - it('W周前', () => { - expect(+new Date(parseRelativeDate('10周前'))).toBe(+date - 10 * week); - }); - - it('W星期前', () => { - expect(+new Date(parseRelativeDate('10星期前'))).toBe(+date - 10 * week); - }); - - it('W个星期前', () => { - expect(+new Date(parseRelativeDate('10个星期前'))).toBe(+date - 10 * week); - }); - - it('M月前', () => { - expect(+new Date(parseRelativeDate('1月前'))).toBe(+date - 1 * month); - }); - - it('M个月前', () => { - expect(+new Date(parseRelativeDate('1个月前'))).toBe(+date - 1 * month); - }); - - it('Y年前', () => { - expect(+new Date(parseRelativeDate('1年前'))).toBe(+date - 1 * year); - }); - - it('Y年M个月前', () => { - expect(+new Date(parseRelativeDate('1年1个月前'))).toBe(+date - 1 * year - 1 * month); - }); - - it('D天H小时前', () => { - expect(+new Date(parseRelativeDate('1天1小时前'))).toBe(+date - 1 * day - 1 * hour); - }); - - it('H小时m分钟s秒钟前', () => { - expect(+new Date(parseRelativeDate('1小时1分钟1秒钟前'))).toBe(+date - 1 * hour - 1 * minute - 1 * second); - }); - - it('H小时m分钟s秒钟后', () => { - expect(+new Date(parseRelativeDate('1小时1分钟1秒钟后'))).toBe(+date + 1 * hour + 1 * minute + 1 * second); - }); - - it('今天', () => { - expect(+new Date(parseRelativeDate('今天'))).toBe(+date.setHours(0, 0, 0, 0)); - }); - - it('Today H:m', () => { - expect(+new Date(parseRelativeDate('Today 08:00'))).toBe(+date + 8 * hour); - }); - - it('TDA H:m:s', () => { - expect(+new Date(parseRelativeDate('TDA 08:00:00'))).toBe(+date + 8 * hour); - }); - - it('今天 H:m', () => { - expect(+new Date(parseRelativeDate('今天 08:00'))).toBe(+date + 8 * hour); - }); - - it('今天H点m分', () => { - expect(+new Date(parseRelativeDate('今天8点0分'))).toBe(+date + 8 * hour); - }); - - it('昨日H点m分s秒', () => { - expect(+new Date(parseRelativeDate('昨日20时0分0秒'))).toBe(+date - 4 * hour); - }); - - it('前天 H:m', () => { - expect(+new Date(parseRelativeDate('前天 20:00'))).toBe(+date - 1 * day - 4 * hour); - }); - - it('明天 H:m', () => { - expect(+new Date(parseRelativeDate('明天 20:00'))).toBe(+date + 1 * day + 20 * hour); - }); - - it('星期几 h:m', () => { - expect(+new Date(parseRelativeDate('星期一 8:00'))).toBe(weekday(1) + 8 * hour); - }); - - it('周几 h:m', () => { - expect(+new Date(parseRelativeDate('周二 8:00'))).toBe(weekday(2) + 8 * hour); - }); - - it('星期天 h:m', () => { - expect(+new Date(parseRelativeDate('星期天 8:00'))).toBe(weekday(7) + 8 * hour); - }); - - it('Invalid', () => { - expect(parseRelativeDate('RSSHub')).toBe('RSSHub'); - }); -}); diff --git a/yarn.lock b/yarn.lock index ed4c341a8613f3..5f92b2daddebb8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1041,11 +1041,6 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@ioredis/commands@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.1.1.tgz#2ba4299ea624a6bfac15b35f6df90b0015691ec3" - integrity sha512-fsR4P/ROllzf/7lXYyElUJCheWdTJVJvOTps8v9IWKFATxR61ANOlnoPqhH099xYLrJGpc2ZQ28B3rMeUt5VQg== - "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -1441,60 +1436,60 @@ domhandler "^4.2.0" selderee "^0.6.0" -"@sentry/core@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.3.tgz#88268afc8c42716c455ad77bb4bed2bbf96abd83" - integrity sha512-RcGmYdkrE3VYBMl9Hgv4GKsC8FEVUdWYsfGIcT/btwP2YpBeUaTZl+1vV9r3Ncdl125LqzP5CKSj5otVxiEg6g== +"@sentry/core@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/core/-/core-6.19.2.tgz#dd35ba6ca41a2dd011c43f732bcdadbb52c06376" + integrity sha512-yu1R3ewBT4udmB4v7sc4biQZ0Z0rfB9+TzB5ZKoCftbe6kqXjFMMaFRYNUF9HicVldKAsBktgkWw3+yfqGkw/A== dependencies: - "@sentry/hub" "6.19.3" - "@sentry/minimal" "6.19.3" - "@sentry/types" "6.19.3" - "@sentry/utils" "6.19.3" + "@sentry/hub" "6.19.2" + "@sentry/minimal" "6.19.2" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" tslib "^1.9.3" -"@sentry/hub@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.3.tgz#d555c83404f19ac9b68f336b051b8e7a9d75feb0" - integrity sha512-iYbkrxEZt6CrHP3U3r54MARVZSs3YHjAMUMOTlC16s/Amz1McwV95XtI3NJaqMhwzl7R5vbGrs3xOtLg1V1Uyw== +"@sentry/hub@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-6.19.2.tgz#0e9f9c507e55d8396002f644b43ef27cc9ff1289" + integrity sha512-W7KCgNBgdBIMagOxy5J5KQPe+maYxSqfE8a5ncQ3R8BcZDQEKnkW/1FplNbfRLZqA/tL/ndKb7pTPqVtzsbARw== dependencies: - "@sentry/types" "6.19.3" - "@sentry/utils" "6.19.3" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" tslib "^1.9.3" -"@sentry/minimal@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.3.tgz#b9b7f0d7f0cd2341b243318668ac01458f9d7889" - integrity sha512-xy/6ThHK8B2NJT98nWrx6V9eVgUbzq2N/8lv5/QqrKsICjxx22TRC8Q6zPg/o7BYcrY5vpugSEbIeErTnyxHDA== +"@sentry/minimal@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-6.19.2.tgz#e748541e4adbc7e80a3b6ccaf01b631c17fc44b4" + integrity sha512-ClwxKm77iDHET7kpzv1JvzDx1er5DoNu+EUjst0kQzARIrXvu9xuZuE2/CnBWycQWqw8o3HoGoKz65uIhsUCzQ== dependencies: - "@sentry/hub" "6.19.3" - "@sentry/types" "6.19.3" + "@sentry/hub" "6.19.2" + "@sentry/types" "6.19.2" tslib "^1.9.3" -"@sentry/node@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.19.3.tgz#afcf106bf72acc0e4bbacbc54744de8a938cbd1c" - integrity sha512-eHreMMbaK4mMAQ45Ki2xJ6in02l66hL6xhltppy/h4m297JIvjaQAFpbQf5XLtO7W4KjdbSV5qnB45D1aOAzFA== +"@sentry/node@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/node/-/node-6.19.2.tgz#cad621ad319f555826110f4d6c972a2fc95800fc" + integrity sha512-Z1qREpTpYHxaeWjc1zMUk8ZTAp1WbxMiI2TVNc+a14DVT19Z2xNXb06MiRfeLgNc9lVGdmzR62dPmMBjVgPJYg== dependencies: - "@sentry/core" "6.19.3" - "@sentry/hub" "6.19.3" - "@sentry/types" "6.19.3" - "@sentry/utils" "6.19.3" + "@sentry/core" "6.19.2" + "@sentry/hub" "6.19.2" + "@sentry/types" "6.19.2" + "@sentry/utils" "6.19.2" cookie "^0.4.1" https-proxy-agent "^5.0.0" lru_map "^0.3.3" tslib "^1.9.3" -"@sentry/types@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.3.tgz#94b19da68d4d23561efb1014f72968bcea85cd0c" - integrity sha512-jHhqxp8MIWSfOc3krorirTGKTEaSFO6XrAvi+2AZhr6gvOChwOgzgrN2ZqesJcZmgCsqWV21u3usSwYeRrjOJA== +"@sentry/types@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/types/-/types-6.19.2.tgz#0219c9da21ed975951108b8541913b1966464435" + integrity sha512-XO5qmVBdTs+7PdCz7fAwn1afWxSnRE2KLBFg5/vOdKosPSSHsSHUURSkxiEZc2QsR+JpRB4AeQ26AkIRX38qTg== -"@sentry/utils@6.19.3": - version "6.19.3" - resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.3.tgz#0c3a3f0b86c12e3b079e56e37a44e62a1226043d" - integrity sha512-GdC9B/FK7qd0zItY43135bYbhuVSawE18bIrQDNuno8gTpDJ5OgShpTN9zR53AmMh16/lwKNnV3ZZjlpKcxuNw== +"@sentry/utils@6.19.2": + version "6.19.2" + resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-6.19.2.tgz#995efb896c5159369509f4896c27a2d2ea9191f2" + integrity sha512-2DQQ2OJaxjtyxGq5FmMlqb6hptsqMs2xoBiVRMkTS/rvyTrk1oQdKZ8ePwjtgX3nJ728ni3IXIyXV+vfGp4EBw== dependencies: - "@sentry/types" "6.19.3" + "@sentry/types" "6.19.2" tslib "^1.9.3" "@sindresorhus/is@^0.14.0": @@ -4581,10 +4576,10 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4, debug@4.3.4, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== +debug@4, debug@4.3.3, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3: + version "4.3.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== dependencies: ms "2.1.2" @@ -4764,10 +4759,10 @@ delegates@^1.0.0: resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o= -denque@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.0.1.tgz#bcef4c1b80dc32efe97515744f21a4229ab8934a" - integrity sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ== +denque@^1.1.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/denque/-/denque-1.5.1.tgz#07f670e29c9a78f8faecb2566a1e2c11929c5cbf" + integrity sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw== depd@2.0.0, depd@^2.0.0, depd@~2.0.0: version "2.0.0" @@ -5516,10 +5511,10 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint@8.12.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.12.0.tgz#c7a5bd1cfa09079aae64c9076c07eada66a46e8e" - integrity sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q== +eslint@8.11.0: + version "8.11.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.11.0.tgz#88b91cfba1356fc10bb9eb592958457dfe09fb37" + integrity sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA== dependencies: "@eslint/eslintrc" "^1.2.1" "@humanwhocodes/config-array" "^0.9.2" @@ -6554,10 +6549,10 @@ googleapis-common@^5.0.2: url-template "^2.0.8" uuid "^8.0.0" -googleapis@100.0.0: - version "100.0.0" - resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-100.0.0.tgz#baeeba7877ee7dd3250643b3803c4a9c24bcf8dd" - integrity sha512-RToFQGY54B756IDbjdyjb1vWFmn03bYpXHB2lIf0eq2UBYsIbYOLZ0kqSomfJnpclEukwEmMF7Jn6Wsev871ew== +googleapis@98.0.0: + version "98.0.0" + resolved "https://registry.yarnpkg.com/googleapis/-/googleapis-98.0.0.tgz#f523a677c11acb155625dac6194fa729ab4480a3" + integrity sha512-gJS+JF03FXouOpHN7dqxg5wrNCBef3ExBtYdCJoX4wlURuy6pixg7SC8sNAjFIXphMZWQ1Bbcu9aKxNv2xCbuQ== dependencies: google-auth-library "^7.0.2" googleapis-common "^5.0.2" @@ -7356,17 +7351,19 @@ interpret@^1.0.0: resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== -ioredis@5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.0.3.tgz#5a742a03128a9924f98b957c8721720b4165b3ab" - integrity sha512-hKxywVypoGGUJDyfnMufO0VNkuIaQufo2/PJ5SOYBKWgf4+gCnZEPaBPle615k08euY9/B9DKytVtwZROF7HaA== +ioredis@4.28.5: + version "4.28.5" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.28.5.tgz#5c149e6a8d76a7f8fa8a504ffc85b7d5b6797f9f" + integrity sha512-3GYo0GJtLqgNXj4YhrisLaNNvWSNwSS2wS4OELGfGxH8I69+XfNdnmV1AyN+ZqMh0i7eX+SWjrwFKDBDgfBC1A== dependencies: - "@ioredis/commands" "^1.1.1" cluster-key-slot "^1.1.0" - debug "^4.3.4" - denque "^2.0.1" + debug "^4.3.1" + denque "^1.1.0" lodash.defaults "^4.2.0" + lodash.flatten "^4.4.0" lodash.isarguments "^3.1.0" + p-map "^2.1.0" + redis-commands "1.7.0" redis-errors "^1.2.0" redis-parser "^3.0.0" standard-as-callback "^2.1.0" @@ -8880,7 +8877,7 @@ lodash.filter@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.filter/-/lodash.filter-4.6.0.tgz#668b1d4981603ae1cc5a6fa760143e480b4c4ace" integrity sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4= -lodash.flatten@^4.2.0: +lodash.flatten@^4.2.0, lodash.flatten@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8= @@ -9006,10 +9003,10 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== -lru-cache@7.7.3: - version "7.7.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.7.3.tgz#98cd19eef89ce6a4a3c4502c17c833888677c252" - integrity sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw== +lru-cache@7.7.1: + version "7.7.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.7.1.tgz#03d2846b1ad2dcc7931a9340b8711d9798fcb0c6" + integrity sha512-cRffBiTW8s73eH4aTXqBcTLU0xQnwGV3/imttRHGWCrbergmnK4D6JXQd8qin5z43HnDwRI+o7mVW0LEB+tpAw== lru-cache@^4.0.1, lru-cache@^4.1.2: version "4.1.5" @@ -10291,7 +10288,7 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" -p-map@^2.0.0: +p-map@^2.0.0, p-map@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== @@ -10423,17 +10420,17 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -parse-torrent@9.1.5: - version "9.1.5" - resolved "https://registry.yarnpkg.com/parse-torrent/-/parse-torrent-9.1.5.tgz#fcae5f360d9baf617d9a2de68e74d5de4c8099fd" - integrity sha512-K8FXRwTOaZMI0/xuv0dpng1MVHZRtMJ0jRWBJ3qZWVNTrC1MzWUxm9QwaXDz/2qPhV2XC4UIHI92IGHwseAwaA== +parse-torrent@9.1.4: + version "9.1.4" + resolved "https://registry.yarnpkg.com/parse-torrent/-/parse-torrent-9.1.4.tgz#1fc8a8accd76c7cd6c858061bb7b679288dc2065" + integrity sha512-NSlG8ewolqfcEWevUUsrpvxzVWYGaKWwPHMcXTAV2qYYo6pPugVOacQXt8uDlEYh23Ituz+A9pAZK5YaXTV8Pg== dependencies: bencode "^2.0.2" blob-to-buffer "^1.2.9" get-stdin "^8.0.0" magnet-uri "^6.2.0" queue-microtask "^1.2.3" - simple-get "^4.0.1" + simple-get "^4.0.0" simple-sha1 "^3.1.0" parse5-htmlparser2-tree-adapter@^6.0.1: @@ -11044,10 +11041,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.6.1, "prettier@^1.18.2 || ^2.0.0": - version "2.6.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.1.tgz#d472797e0d7461605c1609808e27b80c0f9cfe17" - integrity sha512-8UVbTBYGwN37Bs9LERmxCPjdvPxlEowx2urIL6urHzdb3SDq4B/Z6xLFCblrSnE4iKWcS6ziJ3aOYrc1kz/E2A== +prettier@2.6.0, "prettier@^1.18.2 || ^2.0.0": + version "2.6.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4" + integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A== pretty-bytes@^5.1.0: version "5.6.0" @@ -11232,13 +11229,13 @@ pupa@^2.0.1, pupa@^2.1.1: dependencies: escape-goat "^2.0.0" -puppeteer@13.5.2: - version "13.5.2" - resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-13.5.2.tgz#73ae84969cbf514aeee871a05ec4549d67f6abee" - integrity sha512-DJAyXODBikZ3xPs8C35CtExEw78LZR9RyelGDAs0tX1dERv3OfW7qpQ9VPBgsfz+hG2HiMTO/Tyf7BuMVWsrxg== +puppeteer@13.5.1: + version "13.5.1" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-13.5.1.tgz#d0f751bf36120efc2ebf74c7562a204a84e500e9" + integrity sha512-wWxO//vMiqxlvuzHMAJ0pRJeDHvDtM7DQpW1GKdStz2nZo2G42kOXBDgkmQ+zqjwMCFofKGesBeeKxIkX9BO+w== dependencies: cross-fetch "3.1.5" - debug "4.3.4" + debug "4.3.3" devtools-protocol "0.0.969999" extract-zip "2.0.1" https-proxy-agent "5.0.0" @@ -11469,6 +11466,11 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" +redis-commands@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.7.0.tgz#15a6fea2d58281e27b1cd1acfb4b293e278c3a89" + integrity sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ== + redis-errors@^1.0.0, redis-errors@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" @@ -12151,7 +12153,7 @@ simple-concat@^1.0.0: resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== -simple-get@^4.0.1: +simple-get@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543" integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==