diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index e8ae7c595..d1487c26b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,4 @@ # These are supported funding model platforms patreon: DIYgod +custom: ["https://afdian.net/@diygod", "https://diygod.me/images/zfb.jpg", "https://diygod.me/images/wx.jpg"] diff --git a/.github/ISSUE_TEMPLATE/bug_report_en.md b/.github/ISSUE_TEMPLATE/bug_report_en.md index 7d40bd58d..5c1ca4e78 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_en.md +++ b/.github/ISSUE_TEMPLATE/bug_report_en.md @@ -4,21 +4,22 @@ about: Submit discovered bugs --- -### Involved route +- The involved route, with all required and optional parameters -### What is expected? +- What is expected -### What is actually happening? +- What is actually happening -### Self-deployed information +- Self-deployment information @@ -28,4 +29,4 @@ Please ensure you have deployed the [master branch](https://github.com/DIYgod/RS | Node version | | | if Docker, version | | -### Additional info (logs errors etc) +- Additional info (logs errors etc) diff --git a/.github/ISSUE_TEMPLATE/bug_report_zh.md b/.github/ISSUE_TEMPLATE/bug_report_zh.md index 942541d6e..dba7406cc 100644 --- a/.github/ISSUE_TEMPLATE/bug_report_zh.md +++ b/.github/ISSUE_TEMPLATE/bug_report_zh.md @@ -4,22 +4,23 @@ about: 早起的小可爱有虫抓 --- -### 路由地址 +- 完整路由地址,包含所有必选与可选参数 -### 预期是什么? +- 预期是什么 -### 实际发生了什么? +- 实际发生了什么 -### 部署相关信息 +- 部署相关信息 | Env | Value | @@ -28,4 +29,4 @@ about: 早起的小可爱有虫抓 | Node version | | | if Docker, version | | -### 额外信息(日志、报错等) +- 额外信息(日志、报错等) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..d1ffaeb44 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +## 该 PR 相关 Issue / Involved issue + +Close # + +## 完整路由地址 / Example for the proposed route(s) + + diff --git a/.github/workflows/comment-on-pr.yml b/.github/workflows/comment-on-pr.yml new file mode 100644 index 000000000..589a47f38 --- /dev/null +++ b/.github/workflows/comment-on-pr.yml @@ -0,0 +1,15 @@ +name: Comment on Issue + +on: + issues: + types: [opened] + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - name: Comment + uses: ben-z/actions-comment-on-issue@1.0.2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + message: "👍 感谢提交该 Issue,请确保仔细阅读 [Issue 模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_zh.md),[RSS 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.md) 或 [Feature 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_zh.md) 以便于测试。不符合模板将导致 Issue 被直接关闭。

👍 Thanks for the issue, please follow the [Issue template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_en.md), [RSS proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.md) or [Feature proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_en.md). Otherwise the issue will be closed." diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index 54749765f..58e2062e6 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Dockerhub login env: @@ -27,7 +27,7 @@ jobs: id: buildx uses: crazy-max/ghaction-docker-buildx@v1 with: - version: latest + buildx-version: latest - name: Build dockerfile (with push) env: diff --git a/.github/workflows/docker-test.yml b/.github/workflows/docker-test.yml index 33d9a8ccf..ec7670800 100644 --- a/.github/workflows/docker-test.yml +++ b/.github/workflows/docker-test.yml @@ -16,17 +16,18 @@ on: jobs: test: + if: github.repository == "DIYgod/RSSHub" runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: Set up Docker Buildx id: buildx uses: crazy-max/ghaction-docker-buildx@v1 with: - version: latest + buildx-version: latest - name: Build dockerfile (without push) run: | diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000..472953b0e --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,24 @@ +name: format + +on: + push: + branches: master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '14' + - run: yarn install + - run: npm run format + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git status + git diff-index --quiet HEAD || (git commit -m "style: auto format" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 000000000..e5bbe3132 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,27 @@ +name: publish + +on: + push: + branches: master + paths: + - 'lib/**' + +jobs: + build: + if: github.repository == "DIYgod/RSSHub" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '14' + registry-url: 'https://registry.npmjs.org' + - name: Release + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + npx version-from-git --allow-same-version --template 'master.short' + - name: Publish to npmjs + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 000000000..917f6c0c4 --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,21 @@ +name: Automatic Rebase + +on: + issue_comment: + types: [created] + +jobs: + rebase: + if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') && github.event.comment.author_association == 'COLLABORATOR' + runs-on: ubuntu-latest + steps: + - + name: Checkout the latest code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - + name: Automatic Rebase + uses: cirrus-actions/rebase@1.4 + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_SUPER }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b180f18d8..8dc7836c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,6 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-latest services: @@ -16,18 +15,18 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x] + node-version: [10.x, 12.x, 14.x] steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run : yarn install - - run: npm run test + - run: yarn install + - run: npm run jest env: REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/ + - run: npm run docs:build - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/.gitignore b/.gitignore index 7e603f35d..63cf38395 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ tmp *.iml coverage .env + +.now \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 364d3ac7c..000000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: node_js - -node_js: lts/* - -services: - - redis-server - -install: - - yarn - -script: - - npm run test - -after_script: - - npm install codecov - - ./node_modules/.bin/codecov - -cache: - yarn: true - directories: - - node_modules diff --git a/Dockerfile b/Dockerfile index 8da235349..fba1dcb0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,12 +11,12 @@ ARG PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1; RUN ln -sf /bin/bash /bin/sh -RUN apt-get update && apt-get install -yq libgconf-2-4 apt-transport-https git dumb-init --no-install-recommends && apt-get clean \ +RUN apt-get update && apt-get install -yq libgconf-2-4 apt-transport-https git dumb-init python make g++ build-essential --no-install-recommends \ && rm -rf /var/lib/apt/lists/* WORKDIR /app -COPY package.json clean-nm.sh /app/ +COPY package.json tools/clean-nm.sh /app/ RUN if [ "$USE_CHINA_NPM_REGISTRY" = 1 ]; then \ echo 'use npm mirror'; npm config set registry https://registry.npm.taobao.org; \ @@ -29,7 +29,6 @@ RUN if [ "$PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" = 0 ]; then \ && apt-get update \ && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \ --no-install-recommends \ - && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ && apt-get purge --auto-remove -y wget\ && rm -rf /src/*.deb \ diff --git a/README.md b/README.md index 1c07a5206..8c9e8613a 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ ## Introduction -RSSHub is an open source, easy to use, and extensible RSS feed aggregator, it's capable of generating RSS feeds from pretty much everything. +RSSHub is an open source, easy to use, and extensible RSS feed generator. It's capable of generating RSS feeds from pretty much everything. RSSHub delivers millions of contents aggregated from all kinds of sources, our vibrant open source community is ensuring the deliver of RSSHub's new routes, new features and bug fixes. -RSSHub can be used with browser extension [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) +RSSHub can be used with browser extension [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) and iOS auxiliary app [RSSBud](https://github.com/Cay-Zhang/RSSBud) [English docs](https://docs.rsshub.app/en) | [Telegram Group](https://t.me/rsshub) | [Telegram Channel](https://t.me/awesomeRSSHub) @@ -23,7 +23,7 @@ RSSHub can be used with browser extension [RSSHub Radar](https://github.com/DIYg RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以给任何奇奇怪怪的内容生成 RSS 订阅源。RSSHub 借助于开源社区的力量快速发展中,目前已适配数百家网站的上千项内容 -可以配合浏览器扩展 [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) 食用 +可以配合浏览器扩展 [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) 和 iOS 辅助 App [RSSBud](https://github.com/Cay-Zhang/RSSBud) 食用 [中文文档](https://docs.rsshub.app) | [Telegram 群](https://t.me/rsshub) | [Telegram 频道](https://t.me/awesomeRSSHub) @@ -32,12 +32,12 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以 ### Special Sponsors
-             +      多会
### Sponsors -[Sayori Studio](https://t.me/SayoriStudio) . [Sion Kazama](https://blog.sion.moe) . [琚致远](https://www.shaoyaoju.org/) . [Rolly RSS 阅读器](https://www.coolapk.com/apk/239500) . [mokeyjay](https://www.mokeyjay.com/) . [tkaray](https://rayray.moe/) . [NeverBehave](https://never.pet/) . [萌开源联盟](https://www.moeunion.com) +[Sayori Studio](https://t.me/SayoriStudio) . [Sion Kazama](https://blog.sion.moe) . [琚致远](https://www.shaoyaoju.org/) . [Rolly RSS 阅读器](https://www.coolapk.com/apk/239500) . [mokeyjay](https://www.mokeyjay.com/) . [tkaray](https://rayray.moe/) . [萌开源联盟](https://www.moeunion.com) . [hooke007](https://github.com/hooke007/MPV_lazy) . [feeds.pub](https://feeds.pub) [![](https://opencollective.com/static/images/become_sponsor.svg)](https://docs.rsshub.app/en/support/) @@ -51,6 +51,11 @@ Logo designer [sheldonrrr](https://dribbble.com/sheldonrrr)         +## Related Projects + +- [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) | 一个可以帮助你快速发现和订阅当前网站 RSS 和 RSSHub 的浏览器扩展 +- [RSSBud](https://github.com/Cay-Zhang/RSSBud) ([TestFlight 公测](https://testflight.apple.com/join/rjCVzzHP)) | iOS 平台的 RSSHub Radar,专为移动生态优化 + ## Join Us We welcome all pull requests. Suggestions and feedback are also welcomed [here](https://github.com/DIYgod/RSSHub/issues). @@ -87,8 +92,8 @@ Recurring donors will be rewarded via express issue response, or even have your We accept donations via the following ways: -- [WeChat Pay](https://i.loli.net/2019/03/23/5c950ebbc373e.png) -- [Alipay](https://i.loli.net/2019/03/23/5c950ebbc980e.png) +- [WeChat Pay](https://diygod.me/images/wx.jpg) +- [Alipay](https://diygod.me/images/zfb.jpg) - [Paypal](https://www.paypal.me/DIYgod) ## Author diff --git a/api/now.js b/api/now.js new file mode 100644 index 000000000..02ad653ab --- /dev/null +++ b/api/now.js @@ -0,0 +1,14 @@ +const path = require('path'); +const moduleAlias = require('module-alias'); +moduleAlias.addAlias('@', path.join(__dirname, '../lib')); + +const config = require('../lib/config'); +config.set({ + NO_LOGFILES: true, +}); + +const app = require('../lib/app'); + +module.exports = (req, res) => { + app.callback()(req, res); +}; diff --git a/assets/radar-rules-next.js b/assets/radar-rules-next.js deleted file mode 100644 index fb0169669..000000000 --- a/assets/radar-rules-next.js +++ /dev/null @@ -1,1414 +0,0 @@ -({ - 'bilibili.com': { - _name: 'bilibili', - www: [ - { - title: '分区视频', - docs: 'https://docs.rsshub.app/social-media.html#bilibili', - source: ['/v/*tpath', '/documentary', '/movie', '/tv'], - }, - { - title: '视频评论', - docs: 'https://docs.rsshub.app/social-media.html#bilibili', - source: '/video/:aid', - target: (params) => `/bilibili/video/reply/${params.aid.replace('av', '')}`, - }, - { - title: '视频弹幕', - docs: 'https://docs.rsshub.app/social-media.html#bilibili', - source: '/video/:aid', - target: (params, url) => { - const pid = new URL(url).searchParams.get('p'); - return `/bilibili/video/danmaku/${params.aid.replace('av', '')}/${pid ? pid : 1}`; - }, - }, - { - title: '番剧', - docs: 'https://docs.rsshub.app/social-media.html#bilibili', - source: '/bangumi/media/:bid', - target: (params) => `/bilibili/bangumi/media/${params.bid.replace('md', '')}`, - }, - ], - space: [ - { - title: 'UP 主动态', - docs: 'https://docs.rsshub.app/social-media.html#bilibili', - source: '/:uid', - target: '/bilibili/user/dynamic/:uid', - }, - { - title: 'UP 主投稿', - docs: 'https://docs.rsshub.app/social-media.html#bilibili', - source: '/:uid', - target: '/bilibili/user/video/:uid', - }, - ], - }, - 'weibo.com': { - _name: '微博', - '.': [ - { - title: '博主', - docs: 'https://docs.rsshub.app/social-media.html#wei-bo', - source: ['/u/:id', '/:id'], - target: (params, url, document) => { - const uid = document && document.documentElement.innerHTML.match(/\$CONFIG\['oid']='(\d+)'/)[1]; - return uid ? `/weibo/user/${uid}` : ''; - }, - }, - { - title: '关键词', - docs: 'https://docs.rsshub.app/social-media.html#wei-bo', - }, - { - title: '超话', - docs: 'https://docs.rsshub.app/social-media.html#wei-bo', - source: '/p/:id/super_index', - target: '/weibo/super_index/:id', - }, - ], - s: [ - { - title: '热搜榜', - docs: 'https://docs.rsshub.app/social-media.html#wei-bo', - source: '/top/summary', - target: '/weibo/search/hot', - }, - ], - }, - 'pixiv.net': { - _name: 'Pixiv', - www: [ - { - title: '用户收藏', - docs: 'https://docs.rsshub.app/social-media.html#pixiv', - source: '/bookmark.php', - target: (params, url) => `/pixiv/user/bookmarks/${new URL(url).searchParams.get('id')}`, - }, - { - title: '用户动态', - docs: 'https://docs.rsshub.app/social-media.html#pixiv', - source: '/member.php', - target: (params, url) => `/pixiv/user/${new URL(url).searchParams.get('id')}`, - }, - { - title: '排行榜', - docs: 'https://docs.rsshub.app/social-media.html#pixiv', - source: '/ranking.php', - }, - { - title: '关键词', - docs: 'https://docs.rsshub.app/social-media.html#pixiv', - source: '/search.php', - }, - { - title: '关注的新作品', - docs: 'https://docs.rsshub.app/social-media.html#pixiv', - source: '/bookmark_new_illust.php', - target: '/pixiv/user/illustfollows', - }, - ], - }, - 'twitter.com': { - _name: 'Twitter', - '.': [ - { - title: '用户时间线', - docs: 'https://docs.rsshub.app/social-media.html#twitter', - source: '/:id', - target: (params) => { - if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { - return '/twitter/user/:id'; - } - }, - }, - { - title: '用户关注时间线', - docs: 'https://docs.rsshub.app/social-media.html#twitter', - source: '/:id', - target: (params) => { - if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { - return '/twitter/followings/:id'; - } - }, - }, - { - title: '用户喜欢列表', - docs: 'https://docs.rsshub.app/social-media.html#twitter', - source: '/:id', - target: (params) => { - if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { - return '/twitter/likes/:id'; - } - }, - }, - { - title: '列表时间线', - docs: 'https://docs.rsshub.app/social-media.html#twitter', - source: '/:id/lists/:name', - target: (params) => { - if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { - return '/twitter/list/:id/:name'; - } - }, - }, - { - title: '关键词', - docs: 'https://docs.rsshub.app/social-media.html#twitter', - source: '/search', - target: (params, url) => `/twitter/keyword/${new URL(url).searchParams.get('q')}`, - }, - ], - }, - 'youtube.com': { - _name: 'Youtube', - www: [ - { - title: '用户', - docs: 'https://docs.rsshub.app/social-media.html#youtube', - source: '/user/:username', - target: '/youtube/user/:username', - }, - { - title: '频道', - docs: 'https://docs.rsshub.app/social-media.html#youtube', - source: '/channel/:id', - target: '/youtube/channel/:id', - }, - { - title: '播放列表', - docs: 'https://docs.rsshub.app/social-media.html#youtube', - source: '/playlist', - target: (params, url) => `/youtube/playlist/${new URL(url).searchParams.get('list')}`, - }, - ], - }, - 'github.com': { - _name: 'GitHub', - '.': [ - { - title: '用户仓库', - docs: 'https://docs.rsshub.app/programming.html#github', - source: '/:user', - target: '/github/repos/:user', - }, - { - title: '用户 Followers', - docs: 'https://docs.rsshub.app/programming.html#github', - source: '/:user', - target: '/github/user/followers/:user', - }, - { - title: 'Trending', - docs: 'https://docs.rsshub.app/programming.html#github', - source: '/trending', - target: '/github/trending/:since', - }, - { - title: '仓库 Issue', - docs: 'https://docs.rsshub.app/programming.html#github', - source: ['/:user/:repo/issues', '/:user/:repo/issues/:id', '/:user/:repo'], - target: '/github/issue/:user/:repo', - }, - { - title: '仓库 Pull Requests', - docs: 'https://docs.rsshub.app/programming.html#github', - source: ['/:user/:repo/pulls', '/:user/:repo/pulls/:id', '/:user/:repo'], - target: '/github/pull/:user/:repo', - }, - { - title: '仓库 Stars', - docs: 'https://docs.rsshub.app/programming.html#github', - source: ['/:user/:repo/stargazers', '/:user/:repo'], - target: '/github/stars/:user/:repo', - }, - { - title: '仓库 Branches', - docs: 'https://docs.rsshub.app/programming.html#github', - source: ['/:user/:repo/branches', '/:user/:repo'], - target: '/github/branches/:user/:repo', - }, - { - title: '文件 Commits', - docs: 'https://docs.rsshub.app/programming.html#github', - source: '/:user/:repo/blob/:branch/*filepath', - target: '/github/file/:user/:repo/:branch/:filepath', - }, - { - title: '用户 Starred Repositories', - docs: 'https://docs.rsshub.app/programming.html#github', - source: '/:user', - target: '/github/starred_repos/:user', - }, - ], - }, - 'zhihu.com': { - _name: '知乎', - www: [ - { - title: '收藏夹', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/collection/:id', - target: '/zhihu/collection/:id', - }, - { - title: '用户动态', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/people/:id/activities', - target: '/zhihu/people/activities/:id', - }, - { - title: '用户回答', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/people/:id/answers', - target: '/zhihu/people/answers/:id', - }, - { - title: '用户想法', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/people/:id/pins', - target: '/zhihu/people/pins/:id', - }, - { - title: '用户文章', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/people/:id/posts', - target: '/zhihu/people/posts/:id', - }, - { - title: '热榜', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/hot', - target: '/zhihu/hotlist', - }, - { - title: '想法热榜', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - target: '/zhihu/pin/hotlist', - }, - { - title: '问题', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/question/:questionId', - target: '/zhihu/question/:questionId', - }, - { - title: '话题', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/topic/:topicId/:type', - target: '/zhihu/topic/:topicId', - }, - { - title: '新书', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/zhihu/bookstore/newest', - target: '/zhihu/pin/hotlist', - }, - { - title: '想法-24 小时新闻汇总', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/pin/special/972884951192113152', - target: '/zhihu/pin/daily', - }, - { - title: '书店-周刊', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/pub/weekly', - target: '/zhihu/weekly', - }, - ], - zhuanlan: [ - { - title: '专栏', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/:id', - target: '/zhihu/zhuanlan/:id', - }, - ], - daily: [ - { - title: '日报', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '', - target: '/zhihu/daily', - }, - { - title: '日报', - docs: 'https://docs.rsshub.app/social-media.html#zhi-hu', - source: '/*tpath', - target: '/zhihu/daily', - }, - ], - }, - 'smzdm.com': { - _name: '什么值得买', - www: [ - { - title: '排行榜', - docs: 'https://docs.rsshub.app/shopping.html#shen-me-zhi-de-mai', - source: '/top', - }, - ], - search: [ - { - title: '关键词', - docs: 'https://docs.rsshub.app/shopping.html#shen-me-zhi-de-mai', - source: '/', - target: (params, url) => `/smzdm/keyword/${new URL(url).searchParams.get('s')}`, - }, - ], - }, - 'rsshub.app': { - _name: 'RSSHub', - docs: [ - { - title: '有新路由啦', - docs: 'https://docs.rsshub.app/program-update.html#rsshub', - source: ['', '/*tpath'], - target: '/rsshub/routes', - }, - { - title: '有新赞助商啦', - docs: 'https://docs.rsshub.app/program-update.html#rsshub', - source: ['', '/*tpath'], - target: '/rsshub/sponsors', - }, - ], - }, - 'ximalaya.com': { - _name: '喜马拉雅', - www: [ - { - title: '专辑', - docs: 'https://docs.rsshub.app/multimedia.html#xi-ma-la-ya', - source: '/:type/:id', - target: (params) => { - if (parseInt(params.id) + '' === params.id) { - return '/ximalaya/album/:id/'; - } - }, - }, - ], - }, - 'algocasts.io': { - _name: 'AlgoCasts', - '.': [ - { - title: '视频更新', - docs: 'https://docs.rsshub.app/programming.html#algocasts', - source: '/episodes', - target: '/algocasts', - }, - ], - }, - 'soulapp.cn': { - _name: 'Soul', - '.': [ - { - title: '瞬间更新', - docs: 'https://docs.rsshub.app/social-media.html#soul', - }, - ], - }, - 'juejin.im': { - _name: '掘金', - '.': [ - { - title: '专栏', - docs: 'https://docs.rsshub.app/programming.html#jue-jin', - source: '/user/:id/posts', - target: '/juejin/posts/:id', - }, - ], - }, - 'anime1.me': { - _name: 'Anime1', - '.': [ - { - title: '動畫', - docs: 'https://docs.rsshub.app/anime.html#anime1', - source: '/category/:time/:name', - target: '/anime1/anime/:time/:name', - }, - { - title: '搜尋', - docs: 'https://docs.rsshub.app/anime.html#anime1', - source: '/', - target: (params, url) => { - const keyword = new URL(url).searchParams.get('s'); - return keyword ? `/anime1/search/${keyword}` : ''; - }, - }, - ], - }, - 'instagram.com': { - _name: 'Instagram', - www: [ - { - title: '用户', - docs: 'https://docs.rsshub.app/social-media.html#instagram', - source: '/:id', - target: (params) => { - if (params.id !== 'explore' && params.id !== 'developer') { - return '/instagram/user/:id'; - } - }, - }, - { - title: '标签', - docs: 'https://docs.rsshub.app/social-media.html#instagram', - source: '/explore/tags/:tag', - target: '/instagram/tag/:tag', - }, - ], - }, - 'swufe.edu.cn': { - _name: '西南财经大学', - it: [ - { - title: '经济信息工程学院 - 通知公告', - docs: 'https://docs.rsshub.app/university.html#xi-nan-cai-jing-da-xue', - source: '/index/tzgg.htm', - target: '/swufe/seie/tzgg', - }, - { - title: '经济信息工程学院 - 学院新闻', - docs: 'https://docs.rsshub.app/university.html#xi-nan-cai-jing-da-xue', - source: '/index/xyxw.htm', - target: '/swufe/seie/xyxw', - }, - ], - }, - 'ishuhui.com': { - _name: '鼠绘漫画', - www: [ - { - title: '鼠绘漫画', - docs: 'https://docs.rsshub.app/anime.html#shu-hui-man-hua', - source: '/comics/anime/:id', - target: '/shuhui/comics/:id', - }, - ], - }, - 'haimaoba.com': { - _name: '海猫吧', - www: [ - { - title: '漫画更新', - docs: 'https://docs.rsshub.app/anime.html#hai-mao-ba', - source: '/catalog/:id', - target: '/haimaoba/:id', - }, - ], - }, - 'pgyer.com': { - _name: '蒲公英应用分发', - www: [ - { - title: 'app更新', - docs: 'https://docs.rsshub.app/program-update.html#pu-gong-ying-ying-yong-fen-fa', - source: '/:app', - target: '/pgyer/:app', - }, - ], - }, - 'pianyuan.la': { - _name: '片源网', - '.': [ - { - title: '电影和剧集', - docs: 'https://docs.rsshub.app/multimedia.html#pian-yuan', - source: '/', - }, - ], - }, - 'sspai.com': { - _name: '少数派', - '.': [ - { - title: '最新上架付费专栏', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: '/series', - target: '/sspai/series', - }, - { - title: 'Matrix', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: '/matrix', - target: '/sspai/matrix', - }, - { - title: '专栏', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: '/column/:id', - target: '/sspai/column/:id', - }, - { - title: '作者已发布文章', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: ['/user/:id/posts', '/user/:id/updates'], - target: '/sspai/author/:id', - }, - { - title: '专题', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: '/topics', - target: '/sspai/topics', - }, - { - title: '专题内文章更新', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: '/topic/:id', - target: '/sspai/topic/:id', - }, - ], - shortcuts: [ - { - title: 'Shortcuts Gallery', - docs: 'https://docs.rsshub.app/new-media.html#shao-shu-pai-sspai', - source: ['', '/*tpath'], - target: '/sspai/shortcuts', - }, - ], - }, - 'baidu.com': { - _name: '贴吧', - tieba: [ - { - title: '帖子列表', - docs: 'https://docs.rsshub.app/bbs.html#tie-ba', - source: 'f', - target: (params, url) => { - const type = new URL(url).searchParams.get('tab'); - if (!type || type === 'main') { - return `/tieba/forum/${new URL(url).searchParams.get('kw')}`; - } - }, - }, - { - title: '精品帖子', - docs: 'https://docs.rsshub.app/bbs.html#tie-ba', - source: 'f', - target: (params, url) => { - const type = new URL(url).searchParams.get('tab'); - if (type === 'good') { - return `/tieba/forum/good/${new URL(url).searchParams.get('kw')}`; - } - }, - }, - { - title: '帖子动态', - docs: 'https://docs.rsshub.app/bbs.html#tie-ba', - source: '/p/:id', - target: '/tieba/post/:id', - }, - { - title: '只看楼主', - docs: 'https://docs.rsshub.app/bbs.html#tie-ba', - source: '/p/:id', - target: '/tieba/post/lz/:id', - }, - ], - }, - 'wineyun.com': { - _name: '酒云网', - www: [ - { - title: '最新商品', - docs: 'https://docs.rsshub.app/other.html#jiu-yun-wang', - source: ['/:category'], - target: '/wineyun/:category', - }, - ], - }, - 'epicgames.com': { - _name: 'Epic Games', - www: [ - { - title: '每周免费游戏', - docs: 'https://docs.rsshub.app/game.html#epicgames-freegame', - source: '/store/zh-CN/free-games', - target: '/epicgames/freegames', - }, - ], - }, - 'docker.com': { - _name: 'Docker', - hub: [ - { - title: '镜像有新 Build', - docs: 'https://docs.rsshub.app/program-update.html#docker-hub', - source: ['/r/:owner/:image', '/r/:owner/:image/tags', '/_/:image'], - target: (params) => `/dockerhub/build/${params.owner ? params.owner : 'library'}/${params.image}`, - }, - ], - }, - 'nga.cn': { - _name: 'NGA', - bbs: [ - { - title: '分区帖子', - docs: 'https://docs.rsshub.app/bbs.html#nga', - source: '/thread.php', - target: (params, url) => new URL(url).searchParams.get('fid') && `/nga/forum/${new URL(url).searchParams.get('fid')}`, - }, - { - title: '帖子', - docs: 'https://docs.rsshub.app/bbs.html#nga', - source: '/read.php', - target: (params, url) => new URL(url).searchParams.get('tid') && `/nga/post/${new URL(url).searchParams.get('tid')}`, - }, - ], - }, - 'playstation.com': { - _name: 'PlayStation', - store: [ - { - title: '游戏列表', - docs: 'https://docs.rsshub.app/game.html#playstation', - source: '/zh-hans-hk/grid/:id/:page', - target: '/ps/list/:id', - }, - ], - www: [ - { - title: '用户奖杯', - docs: 'https://docs.rsshub.app/game.html#playstation', - }, - { - title: '系统更新纪录', - docs: 'https://docs.rsshub.app/game.html#playstation', - }, - ], - }, - 'monsterhunter.com': { - _name: '怪物猎人世界', - www: [ - { - title: '更新情报', - docs: 'https://docs.rsshub.app/game.html#guai-wu-lie-ren-shi-jie', - source: ['', '/*tpath'], - target: '/mhw/update', - }, - { - title: '最新消息', - docs: 'https://docs.rsshub.app/game.html#guai-wu-lie-ren-shi-jie', - source: ['', '/*tpath'], - target: '/mhw/news', - }, - ], - }, - 'vgtime.com': { - _name: '游戏时光', - www: [ - { - title: '新闻', - docs: 'https://docs.rsshub.app/game.html#you-xi-shi-guang', - source: '/topic/index.jhtml', - target: '/vgtime/news', - }, - { - title: '游戏发售表', - docs: 'https://docs.rsshub.app/game.html#you-xi-shi-guang', - source: '/game/release.jhtml', - target: '/vgtime/release', - }, - { - title: '关键词资讯', - docs: 'https://docs.rsshub.app/game.html#you-xi-shi-guang', - source: '/search/list.jhtml', - target: (params, url) => `/vgtime/keyword/${new URL(url).searchParams.get('keyword')}`, - }, - ], - }, - 'bing.com': { - _name: 'Bing', - www: [ - { - title: '每日壁纸', - docs: 'https://docs.rsshub.app/picture.html#bing-bi-zhi', - source: '', - target: '/bing', - }, - ], - }, - 'dcard.tw': { - _name: 'Dcard', - www: [ - { - title: '首頁帖子-最新', - docs: 'https://docs.rsshub.app/bbs.html#dcard', - source: '/f', - target: '/dcard/posts/latest', - }, - { - title: '首頁帖子-熱門', - docs: 'https://docs.rsshub.app/bbs.html#dcard', - source: '/f', - target: '/dcard/posts/popular', - }, - { - title: '板塊帖子-最新', - docs: 'https://docs.rsshub.app/bbs.html#dcard', - source: '/f/:section', - target: '/dcard/:section/latest', - }, - { - title: '板塊帖子-熱門', - docs: 'https://docs.rsshub.app/bbs.html#dcard', - source: '/f/:section', - target: '/dcard/:section/popular', - }, - ], - }, - 'wegene.com': { - _name: 'WeGene', - www: [ - { - title: '最近更新', - docs: 'https://docs.rsshub.app/other.html#wegene', - source: '', - target: '/wegene/newest', - }, - { - title: '栏目', - docs: 'https://docs.rsshub.app/other.html#wegene', - source: '/crowdsourcing', - target: '/wegene/column/all/all', - }, - ], - }, - 'qdaily.com': { - _name: '好奇心日报', - www: [ - { - title: '标签', - docs: 'https://docs.rsshub.app/new-media.html#hao-qi-xin-ri-bao', - source: '/tags/:idd', - target: (params) => `/qdaily/tag/${params.idd.replace('.html', '')}`, - }, - { - title: '栏目', - docs: 'https://docs.rsshub.app/new-media.html#hao-qi-xin-ri-bao', - source: '/special_columns/:idd', - target: (params) => `/qdaily/column/${params.idd.replace('.html', '')}`, - }, - { - title: '分类', - docs: 'https://docs.rsshub.app/new-media.html#hao-qi-xin-ri-bao', - source: '/categories/:idd', - target: (params) => `/qdaily/category/${params.idd.replace('.html', '')}`, - }, - ], - }, - - '3ycy.com': { - _name: '三界异次元', - www: [ - { - title: '最近更新', - docs: 'https://docs.rsshub.app/anime.html#san-jie-yi-ci-yuan', - source: '/', - target: '/3ycy/home', - }, - ], - }, - - 'emi-nitta.net': { - _name: 'Emi Nitta', - '.': [ - { - title: '最近更新', - docs: 'https://docs.rsshub.app/other.html#xin-tian-hui-hai-guan-fang-wang-zhan', - source: '/updates', - target: '/emi-nitta/updates', - }, - { - title: '新闻', - docs: 'https://docs.rsshub.app/other.html#xin-tian-hui-hai-guan-fang-wang-zhan', - source: '/contents/news', - target: '/emi-nitta/news', - }, - ], - }, - - 'alter-shanghai.cn': { - _name: 'Alter', - '.': [ - { - title: '新闻', - docs: 'https://docs.rsshub.app/shopping.html#alter-zhong-guo', - source: '/cn/news.html', - target: '/alter-cn/news', - }, - ], - }, - - 'itslide.com': { - _name: 'ITSlide', - www: [ - { - title: '最新', - docs: 'https://docs.rsshub.app/programming.html#itslide', - source: '/*', - target: '/itslide/new', - }, - ], - }, - - 'leboncoin.fr': { - _name: 'leboncoin', - www: [ - { - title: 'ads', - docs: 'https://docs.rsshub.app/en/shopping.html#leboncoin', - source: '/recherche', - target: (params, url) => '/leboncoin/ad/' + url.split('?')[1], - }, - ], - }, - - 'yuancheng.work': { - _name: '远程.work', - '.': [ - { - title: '招聘信息', - docs: 'https://docs.rsshub.app/other.html#yuan-cheng-work', - source: '/:caty', - target: (params, url) => { - if (!url) { - return '/remote-work'; - } - return '/remote-work/' + /\w+-(\w+)-\w+/.exec(url)[1]; - }, - }, - ], - }, - - 'chinatimes.com': { - _name: '中時電子報', - www: [ - { - title: '新聞', - docs: 'https://docs.rsshub.app/traditional-media.html#zhong-shi-dian-zi-bao', - source: '/:caty', - target: (params) => '/chinatimes/' + params.caty, - }, - ], - }, - - 'ithome.com': { - _name: 'IT 之家', - it: [ - { - title: 'IT 资讯', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/it', - }, - ], - soft: [ - { - title: '软件之家', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/soft', - }, - ], - win10: [ - { - title: 'win10 之家', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/win10', - }, - ], - iphone: [ - { - title: 'iphone 之家', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/iphone', - }, - ], - ipad: [ - { - title: 'ipad 之家', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/ipad', - }, - ], - android: [ - { - title: 'android 之家', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/android', - }, - ], - digi: [ - { - title: '数码之家', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/digi', - }, - ], - next: [ - { - title: '智能时代', - docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', - source: '/', - target: '/ithome/next', - }, - ], - }, - - 'govopendata.com': { - _name: '新闻联播文字版', - cn: [ - { - title: '新闻联播文字版', - docs: 'https://docs.rsshub.app/traditional-media.html#xin-wen-lian-bo-wen-zi-ban', - source: '/xinwenlianbo', - target: '/xinwenlianbo/index', - }, - ], - }, - - 'steampowered.com': { - _name: 'Steam', - store: [ - { - title: 'search', - docs: 'https://docs.rsshub.app/game.html#steam', - source: '/search/', - target: (params, url) => `/steam/search/${new URL(url).searchParams}`, - }, - { - title: 'news', - docs: 'https://docs.rsshub.app/game.html#steam', - source: '/news/', - target: (params, url) => `/steam/news/${new URL(url).searchParams.get('appids')}`, - }, - ], - }, - 'baijingapp.com': { - _name: '白鲸出海', - www: [ - { - title: '文章', - docs: 'https://docs.rsshub.app/new-media.html#bai-jing-chu-hai', - source: '', - target: '/baijing', - }, - ], - }, - 'xiaomi.cn': { - _name: '小米社区', - www: [ - { - title: '圈子', - docs: 'https://docs.rsshub.app/bbs.html#xiao-mi-she-qu', - source: '/board/:boardId', - target: '/mi/bbs/board/:boardId', - }, - ], - }, - '163.com': { - _name: '网易', - ds: [ - { - title: '大神', - docs: 'https://docs.rsshub.app/game.html#wang-yi-da-shen', - source: '/user/:id', - target: '/netease/ds/:id', - }, - ], - open: [ - { - title: '公开课 - 精品课程', - docs: 'https://docs.rsshub.app/study.html#wang-yi-gong-kai-ke', - source: '/', - target: '/open163/vip', - }, - { - title: '公开课 - 最新课程', - docs: 'https://docs.rsshub.app/study.html#wang-yi-gong-kai-ke', - source: '/', - target: '/open163/latest', - }, - ], - }, - 'suzhou.gov.cn': { - _name: '苏州市政府', - www: [ - { - title: '政府新闻', - docs: 'https://docs.rsshub.app/government.html#su-zhou-shi-ren-min-zheng-fu', - source: '/szsrmzf/:uid/nav_list.shtml', - target: '/gov/suzhou/news/:uid', - }, - ], - }, - 'mqube.net': { - _name: 'MQube', - www: [ - { - title: '全站最近更新', - docs: 'https://docs.rsshub.app/multimedia.html#mqube', - source: '/', - target: '/mqube/latest', - }, - { - title: '全站每日排行', - docs: 'https://docs.rsshub.app/multimedia.html#mqube', - source: '/', - target: '/mqube/top', - }, - { - title: '个人最近更新', - docs: 'https://docs.rsshub.app/multimedia.html#mqube', - source: '/user/:user', - target: '/mqube/user/:user', - }, - { - title: '标签最近更新', - docs: 'https://docs.rsshub.app/multimedia.html#mqube', - source: '/search/tag/:tag', - target: '/mqube/tag/:tag', - }, - ], - }, - 'nikkei.com': { - _name: '日本経済新聞', - www: [ - { - title: 'ホームページ', - docs: 'https://docs.rsshub.app/traditional-media.html#ri-ben-jing-ji-xin-wen', - source: '/', - target: '/nikkei/index', - }, - ], - }, - 'last.fm': { - _name: 'Last.fm', - www: [ - { - title: '用户播放记录', - docs: 'https://docs.rsshub.app/multimedia.html#last-fm', - source: ['/user/:user', '/user/:user/*'], - target: '/lastfm/recent/:user', - }, - { - title: '用户 Love 记录', - docs: 'https://docs.rsshub.app/multimedia.html#last-fm', - source: ['/user/:user', '/user/:user/*'], - target: '/lastfm/loved/:user', - }, - { - title: '站内 Top 榜单', - docs: 'https://docs.rsshub.app/multimedia.html#last-fm', - source: '/charts', - target: '/lastfm/top', - }, - ], - }, - 'ddrk.me': { - _name: '低端影视', - www: [ - { - title: '首页', - docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi', - source: '/', - target: '/ddrk/index', - }, - { - title: '标签', - docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi', - source: '/tag/:tag', - target: '/ddrk/tag/:tag', - }, - { - title: '分类', - docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi', - source: ['/category/:category', '/category/:uplevel/:category'], - target: '/ddrk/category/:category', - }, - { - title: '影视剧集更新', - docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi', - source: ['/:name', '/:name/:season'], - target: (params) => { - if (params.name !== 'category' && params.name !== 'tag' && params.name !== 'ddrklogin' && params.name !== 'about' && params.name !== 'deleted') { - return `/ddrk/update/${params.name}${params.season ? '/' + params.season : ''}`; - } - }, - }, - ], - }, - 'google.com': { - _name: '谷歌', - photos: [ - { - title: '相册', - docs: 'https://docs.rsshub.app/picture.html#google-xiang-ce', - source: '/share/*', - target: (params, url, document) => { - const id = document && document.querySelector('html').innerHTML.match(/photos.app.goo.gl\/(.*?)"/)[1]; - return id ? `/google/album/${id}` : ''; - }, - }, - ], - }, - 'javlibrary.com': { - _name: 'javlibrary', - www: [ - { - title: '新话题', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn', - target: '/javlibrary/videos/update', - }, - { - title: '新发行', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn', - target: '/javlibrary/videos/newrelease', - }, - { - title: '新加入', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn', - target: '/javlibrary/videos/newentries', - }, - { - title: '最想要', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn', - target: '/javlibrary/videos/mostwanted', - }, - { - title: '高评价', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn', - target: '/javlibrary/videos/bestrated', - }, - { - title: '最佳评论', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn', - target: '/javlibrary/bestreviews', - }, - { - title: '影星', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: '/cn/vl_star.php', - target: (params, url) => `/javlibrary/stars/${new URL(url).searchParams.get('s')}`, - }, - { - title: '用户文章', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: ['/cn/user.php', '/cn/userposts.php', '/cn/userwateched.php', '/cn/userowned.php', '/cn/userwanted.php'], - target: (params, url) => `/javlibrary/users/${new URL(url).searchParams.get('u')}/userposts`, - }, - { - title: '用户拥有', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: ['/cn/user.php', '/cn/userposts.php', '/cn/userwateched.php', '/cn/userowned.php', '/cn/userwanted.php'], - target: (params, url) => `/javlibrary/users/${new URL(url).searchParams.get('u')}/userowned`, - }, - { - title: '用户看过', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: ['/cn/user.php', '/cn/userposts.php', '/cn/userwateched.php', '/cn/userowned.php', '/cn/userwanted.php'], - target: (params, url) => `/javlibrary/users/${new URL(url).searchParams.get('u')}/userwatched`, - }, - { - title: '用户想要', - docs: 'https://docs.rsshub.app/multimedia.html#javlibrary', - source: ['/cn/user.php', '/cn/userposts.php', '/cn/userwateched.php', '/cn/userowned.php', '/cn/userwanted.php'], - target: (params, url) => `/javlibrary/users/${new URL(url).searchParams.get('u')}/userwanted`, - }, - ], - }, - 'qidian.com': { - _name: '起点', - book: [ - { - title: '章节', - docs: 'https://docs.rsshub.app/reading.html#qi-dian', - source: '/info/:id', - target: '/qidian/chapter/:id', - }, - { - title: '讨论区', - docs: 'https://docs.rsshub.app/reading.html#qi-dian', - source: '/info/:id', - target: '/qidian/forum/:id', - }, - ], - www: [ - { - title: '限免', - docs: 'https://docs.rsshub.app/reading.html#qi-dian', - source: '/free', - target: '/qidian/free', - }, - { - title: '女生限免', - docs: 'https://docs.rsshub.app/reading.html#qi-dian', - source: '/mm/free', - target: '/qidian/free/mm', - }, - ], - }, - 'hackerone.com': { - _name: 'HackerOne', - '.': [ - { - title: 'HackerOne Hacker Activity', - docs: 'https://docs.rsshub.app/other.html#hackerone-hacker-activity', - source: '/hacktivity', - target: '/hackerone/hacktivity', - }, - ], - }, - 'cowlevel.net': { - _name: '奶牛关', - '.': [ - { - title: '元素文章', - docs: 'https://docs.rsshub.app/game.html#nai-niu-guan', - source: ['/element/:id', '/element/:id/article'], - target: '/cowlevel/element/:id', - }, - ], - }, - 'beijing.gov.cn': { - wjw: [ - { - title: '北京卫生健康委员会', - docs: 'https://docs.rsshub.app/government.html#bei-jing-shi-wei-sheng-jian-kang-wei-yuan-hui', - source: '/xwzx_20031/:caty', - target: '/gov/beijing/mhc/:caty', - }, - ], - }, - 'zju.edu.cn': { - _name: '浙江大学', - cst: [ - { - title: '软件学院 - 全部通知', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: ['', '/*tpath'], - target: '/zju/cst/0', - }, - { - title: '软件学院 - 招生信息', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/32178/list.htm', - target: '/zju/cst/1', - }, - { - title: '软件学院 - 教务管理', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36216/list.htm', - target: '/zju/cst/2', - }, - { - title: '软件学院 - 论文管理', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36217/list.htm', - target: '/zju/cst/3', - }, - { - title: '软件学院 - 思政工作', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36192/list.htm', - target: '/zju/cst/4', - }, - { - title: '软件学院 - 评奖评优', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36228/list.htm', - target: '/zju/cst/5', - }, - { - title: '软件学院 - 实习就业', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36193/list.htm', - target: '/zju/cst/6', - }, - { - title: '软件学院 - 国际实习', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36235/list.htm', - target: '/zju/cst/7', - }, - { - title: '软件学院 - 国内合作科研', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36194/list.htm', - target: '/zju/cst/8', - }, - { - title: '软件学院 - 国际合作科研', - docs: 'https://docs.rsshub.app/university.html#zhe-jiang-da-xue', - source: '/36246/list.htm', - target: '/zju/cst/9', - }, - ], - }, - 'kuaidi100.com': { - _name: '快递100', - '.': [ - { - title: '快递追踪', - docs: 'https://docs.rsshub.app/other.html#kuai-di-100', - source: '/', - target: (params, url, document) => { - const postid = document && document.querySelector('#postid').value; - const com = document && document.querySelector('#selectComBtn').childNodes[1].attributes[1].value; - if (com && com !== 'default' && postid) { - return `/kuaidi100/track/${com}/${postid}`; - } - }, - }, - { - title: '支持的快递公司列表', - docs: 'https://docs.rsshub.app/other.html#kuai-di-100', - source: '/', - target: '/kuaidi100/company', - }, - ], - }, - 'japanpost.jp': { - _name: '日本郵便', - 'trackings.post': [ - { - title: '郵便・荷物の追跡', - docs: 'https://docs.rsshub.app/other.html#ri-ben-you-bian', - source: '/services/srv/search/direct', - target: (url) => { - const reqCode = new URL(url).searchParams.get('reqCodeNo1').toUpperCase(); - const locale = new URL(url).searchParams.get('locale').toLowerCase(); - if ((reqCode.search(/^(?:\d{12}|[A-Z]{2}\d{9}[A-Z]{2})$/) === 0 && locale === 'ja') || locale === 'en') { - return `/japanpost/${reqCode}/${locale}`; - } - }, - }, - ], - }, - 'biquge5200.com': { - www: [ - { - title: '当前小说', - docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge', - source: '/:id', - target: '/novel/biquge/:id', - }, - ], - }, -}); diff --git a/assets/radar-rules.js b/assets/radar-rules.js index 5d5c74ede..47b97b290 100644 --- a/assets/radar-rules.js +++ b/assets/radar-rules.js @@ -42,6 +42,50 @@ source: '/:uid', target: '/bilibili/user/video/:uid', }, + { + title: 'UP 主专栏', + docs: 'https://docs.rsshub.app/social-media.html#bilibili', + source: '/:uid', + target: '/bilibili/user/article/:uid', + }, + { + title: 'UP 主默认收藏夹', + docs: 'https://docs.rsshub.app/social-media.html#bilibili', + source: '/:uid', + target: '/bilibili/user/fav/:uid', + }, + { + title: 'UP 主投币视频', + docs: 'https://docs.rsshub.app/social-media.html#bilibili', + source: '/:uid', + target: '/bilibili/user/coin/:uid', + }, + { + title: 'UP 主粉丝', + docs: 'https://docs.rsshub.app/social-media.html#bilibili', + source: '/:uid', + target: '/bilibili/user/followers/:uid', + }, + { + title: 'UP 主关注用户', + docs: 'https://docs.rsshub.app/social-media.html#bilibili', + source: '/:uid', + target: '/bilibili/user/followings/:uid', + }, + { + title: '用户追番列表', + docs: 'https://docs.rsshub.app/social-media.html#bilibili', + source: '/:uid', + target: '/bilibili/user/bangumi/:uid', + }, + ], + manga: [ + { + title: '漫画更新', + docs: 'https://docs.rsshub.app/social-media.html#bilibili-man-hua-geng-xin', + source: '/detail/:comicid', + target: '/bilibili/manga/update/:comicid', + }, ], }, 'weibo.com': { @@ -51,9 +95,10 @@ title: '博主', docs: 'https://docs.rsshub.app/social-media.html#wei-bo', source: ['/u/:id', '/:id'], - target: '/weibo/user/:uid', - script: "({uid: document.querySelector('head').innerHTML.match(/\\$CONFIG\\['oid']='(\\d+)'/)[1]})", - verification: (params) => params.uid, + target: (params, url, document) => { + const uid = document && document.documentElement.innerHTML.match(/\$CONFIG\['oid']='(\d+)'/)[1]; + return uid ? `/weibo/user/${uid}` : ''; + }, }, { title: '关键词', @@ -115,29 +160,41 @@ title: '用户时间线', docs: 'https://docs.rsshub.app/social-media.html#twitter', source: '/:id', - target: '/twitter/user/:id', - verification: (params) => params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search', + target: (params) => { + if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { + return '/twitter/user/:id'; + } + }, }, { title: '用户关注时间线', docs: 'https://docs.rsshub.app/social-media.html#twitter', source: '/:id', - target: '/twitter/followings/:id', - verification: (params) => params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search', + target: (params) => { + if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { + return '/twitter/followings/:id'; + } + }, }, { title: '用户喜欢列表', docs: 'https://docs.rsshub.app/social-media.html#twitter', source: '/:id', - target: '/twitter/likes/:id', - verification: (params) => params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search', + target: (params) => { + if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { + return '/twitter/likes/:id'; + } + }, }, { title: '列表时间线', docs: 'https://docs.rsshub.app/social-media.html#twitter', source: '/:id/lists/:name', - target: '/twitter/list/:id/:name', - verification: (params) => params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search', + target: (params) => { + if (params.id !== 'home' && params.id !== 'explore' && params.id !== 'notifications' && params.id !== 'messages' && params.id !== 'explore' && params.id !== 'search') { + return '/twitter/list/:id/:name'; + } + }, }, { title: '关键词', @@ -148,7 +205,7 @@ ], }, 'youtube.com': { - _name: 'Youtube', + _name: 'YouTube', www: [ { title: '用户', @@ -370,13 +427,16 @@ }, 'ximalaya.com': { _name: '喜马拉雅', - www: [ + '.': [ { title: '专辑', docs: 'https://docs.rsshub.app/multimedia.html#xi-ma-la-ya', source: '/:type/:id', - target: '/ximalaya/album/:id/', - verification: (params) => parseInt(params.id) + '' === params.id, + target: (params) => { + if (parseInt(params.id) + '' === params.id) { + return '/ximalaya/album/:id/'; + } + }, }, ], }, @@ -400,15 +460,45 @@ }, ], }, - 'juejin.im': { + 'juejin.cn': { _name: '掘金', '.': [ + { + title: '标签', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-biao-qian', + source: '/tag/:tag', + target: '/juejin/tag/:tag', + }, + { + title: '小册', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-xiao-ce', + source: '/books', + target: '/juejin/books', + }, + { + title: '沸点', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-fei-dian', + source: ['/pins/:type', '/pins/topic/:type'], + target: (params) => (params.type !== 'recommended' ? '/juejin/pins/:type' : '/juejin/pins'), + }, { title: '专栏', - docs: 'https://docs.rsshub.app/programming.html#jue-jin', - source: '/user/:id/posts', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-zhuan-lan', + source: ['/user/:id', '/user/:id/posts'], target: '/juejin/posts/:id', }, + { + title: '收藏集', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-shou-cang-ji', + source: ['/user/:id', '/user/:id/collections'], + target: '/juejin/collections/:id', + }, + { + title: '单个收藏夹', + docs: 'https://docs.rsshub.app/programming.html#jue-jin-dan-ge-shou-cang-jia', + source: '/collection/:collectionId', + target: '/juejin/collection/:collectionId', + }, ], }, 'anime1.me': { @@ -424,27 +514,10 @@ title: '搜尋', docs: 'https://docs.rsshub.app/anime.html#anime1', source: '/', - script: "({keyword: new URLSearchParams(location.search).get('s')})", - target: '/anime1/search/:keyword', - verification: (params) => params.keyword, - }, - ], - }, - 'instagram.com': { - _name: 'Instagram', - www: [ - { - title: '用户', - docs: 'https://docs.rsshub.app/social-media.html#instagram', - source: '/:id', - target: '/instagram/user/:id', - verification: (params) => params.id !== 'explore' && params.id !== 'developer', - }, - { - title: '标签', - docs: 'https://docs.rsshub.app/social-media.html#instagram', - source: '/explore/tags/:tag', - target: '/instagram/tag/:tag', + target: (params, url) => { + const keyword = new URL(url).searchParams.get('s'); + return keyword ? `/anime1/search/${keyword}` : ''; + }, }, ], }, @@ -476,6 +549,16 @@ }, ], }, + 'www.chicagotribune.com': { + _name: 'Chicago Tribune', + www: [ + { + title: 'Chicago Tribune', + docs: 'https://docs.rsshub.app/traditional_media.html#chicago-tribune', + source: '/', + }, + ], + }, 'haimaoba.com': { _name: '海猫吧', www: [ @@ -564,17 +647,23 @@ title: '帖子列表', docs: 'https://docs.rsshub.app/bbs.html#tie-ba', source: 'f', - target: (params, url) => `/tieba/forum/${new URL(url).searchParams.get('kw')}`, - script: "({type: new URLSearchParams(location.search).get('tab')})", - verification: (params) => !params.type || params.type === 'main', + target: (params, url) => { + const type = new URL(url).searchParams.get('tab'); + if (!type || type === 'main') { + return `/tieba/forum/${new URL(url).searchParams.get('kw')}`; + } + }, }, { title: '精品帖子', docs: 'https://docs.rsshub.app/bbs.html#tie-ba', source: 'f', - target: (params, url) => `/tieba/forum/good/${new URL(url).searchParams.get('kw')}`, - script: "({type: new URLSearchParams(location.search).get('tab')})", - verification: (params) => params.type === 'good', + target: (params, url) => { + const type = new URL(url).searchParams.get('tab'); + if (type === 'good') { + return `/tieba/forum/good/${new URL(url).searchParams.get('kw')}`; + } + }, }, { title: '帖子动态', @@ -649,6 +738,12 @@ source: '/zh-hans-hk/grid/:id/:page', target: '/ps/list/:id', }, + { + title: '折扣|价格', + docs: 'https://docs.rsshub.app/game.html#playstation', + source: ['/:lang/product/:gridName'], + target: '/ps/:lang/product/:gridName', + }, ], www: [ { @@ -879,6 +974,26 @@ 'ithome.com': { _name: 'IT 之家', + '.': [ + { + title: '24 小时阅读榜', + docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', + source: ['', '/*'], + target: '/ithome/ranking/24h', + }, + { + title: '7 天最热', + docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', + source: ['', '/*'], + target: '/ithome/ranking/7days', + }, + { + title: '月榜', + docs: 'https://docs.rsshub.app/new-media.html#it-zhi-jia', + source: ['', '/*'], + target: '/ithome/ranking/monthly', + }, + ], it: [ { title: 'IT 资讯', @@ -1120,8 +1235,11 @@ title: '影视剧集更新', docs: 'https://docs.rsshub.app/multimedia.html#di-duan-ying-shi', source: ['/:name', '/:name/:season'], - target: (params) => `/ddrk/update/${params.name}${params.season ? '/' + params.season : ''}`, - verification: (params) => params.name !== 'category' && params.name !== 'tag' && params.name !== 'ddrklogin' && params.name !== 'about' && params.name !== 'deleted', + target: (params) => { + if (params.name !== 'category' && params.name !== 'tag' && params.name !== 'ddrklogin' && params.name !== 'about' && params.name !== 'deleted') { + return `/ddrk/update/${params.name}${params.season ? '/' + params.season : ''}`; + } + }, }, ], }, @@ -1132,8 +1250,10 @@ title: '相册', docs: 'https://docs.rsshub.app/picture.html#google-xiang-ce', source: '/share/*', - target: '/google/album/:id', - script: "({id: document.querySelector('html').innerHTML.match(/photos.app.goo.gl\\/(.*?)\"/)[1]})", + target: (params, url, document) => { + const id = document && document.querySelector('html').innerHTML.match(/photos.app.goo.gl\/(.*?)"/)[1]; + return id ? `/google/album/${id}` : ''; + }, }, ], sites: [ @@ -1279,6 +1399,51 @@ }, ], }, + 'ynu.edu.cn': { + _name: '云南大学', + home: [ + { + title: '官网消息通告', + docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', + source: '/tzgg.htm', + target: '/ynu/home', + }, + ], + jwc: [ + { + title: '教务处教务科通知', + docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', + source: '/*', + target: '/jwc/1', + }, + { + title: '教务处学籍科通知', + docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', + source: '/*', + target: '/jwc/2', + }, + { + title: '教务处教学研究科通知', + docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', + source: '/*', + target: '/jwc/3', + }, + { + title: '教务处实践科学科通知', + docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', + source: '/*', + target: '/jwc/4', + }, + ], + grs: [ + { + title: '研究生院通知', + docs: 'https://docs.rsshub.app/university.html#yun-nan-da-xue', + source: '/*', + target: '', + }, + ], + }, 'zju.edu.cn': { _name: '浙江大学', cst: [ @@ -1351,9 +1516,13 @@ title: '快递追踪', docs: 'https://docs.rsshub.app/other.html#kuai-di-100', source: '/', - target: (params) => `/kuaidi100/track/${params.com}/${params.postid}`, - script: "({postid: document.querySelector('#postid').value, com: document.querySelector('#selectComBtn').childNodes[1].attributes[1].value})", - verification: (params) => params.com !== 'default' && params.postid, + target: (params, url, document) => { + const postid = document && document.querySelector('#postid').value; + const com = document && document.querySelector('#selectComBtn').childNodes[1].attributes[1].value; + if (com && com !== 'default' && postid) { + return `/kuaidi100/track/${com}/${postid}`; + } + }, }, { title: '支持的快递公司列表', @@ -1467,9 +1636,13 @@ title: '郵便・荷物の追跡', docs: 'https://docs.rsshub.app/other.html#ri-ben-you-bian', source: '/services/srv/search/direct', - target: (params) => `/japanpost/${params.reqCode}/${params.locale}`, - script: "({reqCode: new URLSearchParams(location.search).get('reqCodeNo1').toUpperCase(), locale: new URLSearchParams(location.search).get('locale').toLowerCase()})", - verification: (params) => (params.reqCode.search(/^(?:\d{12}|[A-Z]{2}\d{9}[A-Z]{2})$/) === 0 && params.locale === 'ja') || params.locale === 'en', + target: (params, url) => { + const reqCode = new URL(url).searchParams.get('reqCodeNo1').toUpperCase(); + const locale = new URL(url).searchParams.get('locale').toLowerCase(); + if ((reqCode.search(/^(?:\d{12}|[A-Z]{2}\d{9}[A-Z]{2})$/) === 0 && locale === 'ja') || locale === 'en') { + return `/japanpost/${reqCode}/${locale}`; + } + }, }, ], }, @@ -1516,13 +1689,23 @@ 'biquge5200.com': { www: [ { - title: '当前小说', - docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge', + title: 'biquge5200.com', + docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge-biquge5200-com', source: '/:id', target: '/novel/biquge/:id', }, ], }, + 'biquge.info': { + www: [ + { + title: 'biquge.info', + docs: 'https://docs.rsshub.app/reading.html#bi-qu-ge-biquge-info', + source: '/:id', + target: '/novel/biqugeinfo/:id', + }, + ], + }, 'matters.news': { _name: 'Matters', '.': [ @@ -1557,7 +1740,7 @@ }, 'zhaishuyuan.com': { _name: '斋书苑', - www: [ + '.': [ { title: '最新章节', docs: 'https://docs.rsshub.app/reading.html#zhai-shu-yuan', @@ -1655,7 +1838,7 @@ title: '用户作品', docs: 'https://docs.rsshub.app/design.html#zhan-ku', source: ['/u/:id'], - target: (params) => `/zcoo/user/${params.id}`, + target: `/zcoo/user/:id`, }, ], }, @@ -1666,9 +1849,12 @@ title: '频道', docs: 'https://docs.rsshub.app/social-media.html#telegram', source: '/:username', - target: '/telegram/channel/:username', - script: "({isChannel:document.querySelector('.tgme_action_button_label')})", - verification: (params) => params.isChannel, + target: (params, url, document) => { + const isChannel = document && document.querySelector('.tgme_action_button_label'); + if (isChannel) { + return '/telegram/channel/:username'; + } + }, }, { title: '频道', @@ -1678,4 +1864,640 @@ }, ], }, + 'zhuixinfan.com': { + _name: '追新番日剧站', + '.': [ + { + title: '更新列表', + docs: 'https://docs.rsshub.app/multimedia.html#zhui-xin-fan-ri-ju-zhan', + source: ['/main.php'], + target: '/zhuixinfan/list', + }, + ], + }, + 'etoland.co.kr': { + _name: 'eTOLAND', + '.': [ + { + title: '主题贴', + docs: 'https://docs.rsshub.app/bbs.html#etoland', + source: ['/bbs/board.php', '/plugin/mobile/board.php'], + target: (params, url) => `/etoland/${new URL(url).searchParams.get('bo_table')}`, + }, + ], + }, + 'qq.com': { + _name: '腾讯', + 'mp.weixin': [ + { + title: '微信公众号栏目', + docs: 'https://docs.rsshub.app/new-media.html#gong-zhong-hao-lan-mu-fei-tui-song-li-shi-xiao-xi', + source: '/mp/homepage', + target: (params, url) => `/wechat/mp/homepage/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('hid')}/${new URL(url).searchParams.get('cid') ? new URL(url).searchParams.get('cid') : ''}`, + }, + { + title: '微信公众号话题', + docs: 'https://docs.rsshub.app/new-media.html#wei-xin-gong-zhong-hao-wen-zhang-hua-ti-tag', + source: '/mp/appmsgalbum', + target: (params, url) => `/wechat/mp/msgalbum/${new URL(url).searchParams.get('__biz')}/${new URL(url).searchParams.get('album_id')}`, + }, + ], + egame: [ + { + title: '企鹅电竞直播间', + docs: 'https://docs.rsshub.app/live.html#qi-e-dian-jing-zhi-bo-jian-kai-bo', + source: '/:id', + target: (params) => { + if (params.id.match(/^\d+$/)) { + return '/egameqq/room/:id'; + } + }, + }, + ], + }, + 'javbus.com': { + _name: 'JavBus', + www: [ + { + title: '首页', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/', + target: '/javbus/home', + }, + { + title: '分类', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/genre/:gid', + target: '/javbus/genre/:gid', + }, + { + title: '演员', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/star/:sid', + target: '/javbus/star/:sid', + }, + { + title: '系列', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/series/:seriesid', + target: '/javbus/series/:seriesid', + }, + { + title: '首页 / 步兵', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/uncensored', + target: '/javbus/uncensored/home', + }, + { + title: '分类 / 步兵', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/uncensored/genre/:gid', + target: '/javbus/uncensored/genre/:gid', + }, + { + title: '演员 / 步兵', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/uncensored/star/:sid', + target: '/javbus/uncensored/star/:sid', + }, + { + title: '系列 / 步兵', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/uncensored/series/:seriesid', + target: '/javbus/uncensored/series/:seriesid', + }, + ], + }, + 'javbus.one': { + _name: 'JavBus', + www: [ + { + title: '首页 / 欧陆风云', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/', + target: '/javbus/western/home', + }, + { + title: '分类 / 欧陆风云', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/genre/:gid', + target: '/javbus/western/genre/:gid', + }, + { + title: '演员 / 欧陆风云', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/star/:sid', + target: '/javbus/western/star/:sid', + }, + { + title: '系列 / 欧陆风云', + docs: 'https://docs.rsshub.app/multimedia.html#javbus', + source: '/series/:seriesid', + target: '/javbus/western/series/:seriesid', + }, + ], + }, + 'onejav.com': { + _name: 'OneJAV BT', + '.': [ + { + title: '今日种子', + docs: 'https://docs.rsshub.app/multimedia.html#onejav', + source: '/', + target: (params, url, document) => { + const today = document.querySelector('div.card.mb-1.card-overview').getAttribute('data-date').replace(/-/g, ''); + return `/onejav/day/${today}`; + }, + }, + { + title: '今日演员', + docs: 'https://docs.rsshub.app/multimedia.html#onejav', + source: '/', + target: (params, url, document) => { + const star = document.querySelector('div.card-content > div > a').getAttribute('href'); + return `/onejav${star}`; + }, + }, + { + title: '页面种子', + docs: 'https://docs.rsshub.app/multimedia.html#onejav', + source: ['/:type', '/:type/:key', '/:type/:key/:morekey'], + target: (params, url, document) => { + const itype = params.morekey === undefined ? `${params.type}` : params.type === 'tag' ? 'tag' : 'day'; + let ikey = `${itype === 'day' ? params.type : ''}${params.key || ''}${itype === 'tag' && params.morekey !== undefined ? '%2F' : ''}${params.morekey || ''}`; + if (ikey === '' && itype === 'tag') { + ikey = document.querySelector('div.thumbnail.is-inline > a').getAttribute('href').replace('/tag/', '').replace('/', '%2F'); + } else if (ikey === '' && itype === 'actress') { + ikey = document.querySelector('div.card > a').getAttribute('href').replace('/actress/', ''); + } + return `/onejav/${itype}/${ikey}`; + }, + }, + ], + }, + 'sexinsex.net': { + _name: 'sexinsex', + '.': [ + { + title: '分区帖子', + docs: 'https://docs.rsshub.app/multimedia.html#sexinsex', + source: '/bbs/:path', + target: (params, url) => { + let pid, typeid; + const static_matched = params.path.match(/forum-(\d+)-\d+.html/); + if (static_matched) { + pid = static_matched[1]; + } else if (params.path === 'forumdisplay.php') { + pid = new URL(url).searchParams.get('fid'); + typeid = new URL(url).searchParams.get('typeid'); + } else { + return false; + } + return `/sexinsex/${pid}/${typeid ? typeid : ''}`; + }, + }, + ], + }, + 't66y.com': { + _name: '草榴社区', + www: [ + { + title: '分区帖子', + docs: 'https://docs.rsshub.app/multimedia.html#cao-liu-she-qu', + source: '/thread0806.php', + target: (params, url) => { + const id = new URL(url).searchParams.get('fid'); + const type = new URL(url).searchParams.get('type'); + return `/t66y/${id}/${type ? type : ''}`; + }, + }, + ], + }, + 'umass.edu': { + _name: 'UMASS Amherst', + ece: [ + { + title: 'ECE News', + docs: 'http://docs.rsshub.app/en/university.html#umass-amherst', + source: '/news', + target: '/umass/amherst/ecenews', + }, + ], + 'www.cics': [ + { + title: 'CICS News', + docs: 'http://docs.rsshub.app/en/university.html#umass-amherst', + source: '/news', + target: '/umass/amherst/csnews', + }, + ], + www: [ + { + title: 'IPO Events', + docs: 'http://docs.rsshub.app/en/university.html#umass-amherst', + source: '/ipo/iss/events', + target: '/umass/amherst/ipoevents', + }, + { + title: 'IPO Featured Stories', + docs: 'http://docs.rsshub.app/en/university.html#umass-amherst', + source: '/ipo/iss/featured-stories', + target: '/umass/amherst/ipostories', + }, + ], + }, + 'lofter.com': { + _name: 'Lofter', + www: [ + { + title: '话题 (标签)', + docs: 'https://docs.rsshub.app/social-media.html#lofter', + source: ['/tag/:name', '/tag/:name/:type'], + target: (params) => `/lofter/tag/${params.name}/${params.type || ''}`, + }, + ], + }, + + 'yuque.com': { + _name: '语雀', + www: [ + { + title: '知识库', + docs: 'https://docs.rsshub.app/study.html#yu-que', + source: ['/:space/:book'], + target: (params, url, document) => { + const match = document.documentElement.innerHTML.match(/JSON\.parse\(decodeURIComponent\("(.*)"\)/); + if (match && match[1]) { + const dataStr = match[1]; + try { + const appData = JSON.parse(decodeURIComponent(dataStr)); + return `/yuque/doc/${appData.book.id}`; + } catch (e) { + // pass + } + } + }, + }, + ], + }, + 'bjeea.com': { + _name: '北京考试院', + www: [ + { + title: '首页 / 通知公告', + docs: 'https://docs.rsshub.app/government.html#bei-jing-jiao-yu-kao-shi-yuan', + source: ['/html/bjeeagg'], + target: '/gov/beijing/bjeea/bjeeagg', + }, + { + title: '首页 / 招考政策', + docs: 'https://docs.rsshub.app/government.html#bei-jing-jiao-yu-kao-shi-yuan', + source: ['/html/zkzc'], + target: '/gov/beijing/bjeea/zkzc', + }, + { + title: '首页 / 自考快递', + docs: 'https://docs.rsshub.app/government.html#bei-jing-jiao-yu-kao-shi-yuan', + source: ['/html/zkkd'], + target: '/gov/beijing/bjeea/zkkd', + }, + ], + }, + 'hk01.com': { + _name: '香港01', + www: [ + { + title: '最 Hit', + docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01', + source: ['/hot', '/'], + target: '/hk01/hot', + }, + { + title: 'zone', + docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01', + source: '/zone/:id/:title', + target: '/hk01/zone/:id', + }, + { + title: 'channel', + docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01', + source: '/channel/:id/:title', + target: '/hk01/channel/:id', + }, + { + title: 'issue', + docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01', + source: '/issue/:id/:title', + target: '/hk01/issue/:id', + }, + { + title: 'tag', + docs: 'https://docs.rsshub.app/traditional-media.html#xiang-gang-01', + source: '/tag/:id/:title', + target: '/hk01/tag/:id', + }, + ], + }, + 'douban.com': { + _name: '豆瓣', + www: [ + { + title: '用户的广播', + docs: 'https://docs.rsshub.app/social-media.html#dou-ban', + source: '/people/:user/', + target: (params, url, document) => { + const uid = document && document.querySelector('html').innerHTML.match(/"id":"([0-9]+)"/)[1]; + return uid ? `/douban/people/${uid}/status` : ''; + }, + }, + ], + }, + 'okjike.com': { + _name: '即刻', + m: [ + { + title: '用户动态', + docs: 'https://docs.rsshub.app/social-media.html#ji-ke-yong-hu-dong-tai', + source: '/reposts/:repostId', + target: (params, url, document) => { + const uid = document.querySelector('.avatar').getAttribute('href').replace('/users/', ''); + return uid ? `/jike/user/${uid}` : ''; + }, + }, + { + title: '圈子', + docs: 'https://docs.rsshub.app/social-media.html#ji-ke-quan-zi', + source: '/topics/:id', + target: '/jike/topic/:id', + }, + { + title: '圈子 - 纯文字', + docs: 'https://docs.rsshub.app/social-media.html#ji-ke-quan-zi-chun-wen-zi', + source: '/topics/:id', + target: '/jike/topic/text/:id', + }, + ], + }, + 'ems.com.cn': { + _name: '中国邮政速递物流', + www: [ + { + title: '新闻', + docs: 'https://docs.rsshub.app/other.html#zhong-guo-you-zheng-su-di-wu-liu', + source: '/aboutus/xin_wen_yu_shi_jian.html', + target: '/ems/news', + }, + ], + }, + 'popiapp.cn': { + _name: 'Popi 提问箱', + www: [ + { + title: '提问箱新回答', + docs: 'https://docs.rsshub.app/social-media.html#popi-ti-wen-xiang', + source: '/:id', + target: (params) => { + if (params.id) { + return '/popiask/:id'; + } + }, + }, + ], + }, + 'nppa.gov.cn': { + _name: '国家新闻出版署', + www: [ + { + title: '栏目', + docs: 'https://docs.rsshub.app/government.html#guo-jia-xin-wen-chu-ban-shu', + source: '/nppa/channels/:channel', + target: (params, url) => `/gov/nppa/${/nppa\/channels\/(\d+)\.shtml/.exec(url)[1]}`, + }, + { + title: '内容', + docs: 'https://docs.rsshub.app/government.html#guo-jia-xin-wen-chu-ban-shu', + source: '/nppa/contents/:channel/:content', + target: (params, url) => `/gov/nppa/${/nppa\/contents\/(\d+\/\d+)\.shtml/.exec(url)[1]}`, + }, + ], + }, + 'acfun.cn': { + _name: 'AcFun', + www: [ + { + tilte: '番剧', + docs: 'https://docs.rsshub.app/anime.html#acfun-fan-ju', + source: '/bangumi/:id', + target: (params) => `/acfun/bangumi/${params.id.replace('aa', '')}`, + }, + { + title: '用户投稿', + docs: 'https://docs.rsshub.app/anime.html#acfun-yong-hu-tou-gao', + source: '/u/:id', + target: '/acfun/user/video/:id', + }, + ], + }, + 'behance.net': { + _name: 'Behance', + www: [ + { + title: 'User', + docs: 'https://docs.rsshub.app/design.html#behance-user-works', + source: ['/:user'], + target: (params, url, document) => { + const uid1 = document && document.querySelector('html').innerHTML.match(/([^/]+)\/insights/)[1]; + return `/behance/${uid1}`; + }, + }, + ], + }, + 'picuki.com': { + _name: 'Picuki', + www: [ + { + title: '用户', + docs: 'https://docs.rsshub.app/social-media.html#picuki-yong-hu', + source: '/profile/:id', + target: '/picuki/profile/:id', + }, + ], + }, + 'jjmhw.cc': { + _name: '漫小肆', + www: [ + { + title: '漫画更新', + docs: 'https://docs.rsshub.app/anime.html#man-xiao-si', + source: '/book/:id', + target: '/manxiaosi/book/:id', + }, + ], + }, + 'wenxuecity.com': { + _name: '文学城', + blog: [ + { + title: '博客', + docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-bo-ke', + source: '/myblog/:id', + target: '/wenxuecity/blog/:id', + }, + { + title: '博客', + docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-bo-ke', + source: '/myoverview/:id', + target: '/wenxuecity/blog/:id', + }, + ], + bbs: [ + { + title: '最新主题', + docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-zui-xin-zhu-ti', + source: '/:cat', + target: '/wenxuecity/bbs/:cat', + }, + { + title: '最新主题 - 精华区', + docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-zui-xin-zhu-ti', + source: '/:cat', + target: '/wenxuecity/bbs/:cat/1', + }, + { + title: '最热主题', + docs: 'https://docs.rsshub.app/bbs.html#wen-xue-cheng-zui-re-zhu-ti', + source: '/?cid=*', + target: (params, url, document) => { + const cid = document && new URL(document.location).searchParams.get('cid'); + return `/wenxuecity/hot/${cid}`; + }, + }, + ], + }, + 'buaq.net': { + _name: '不安全资讯', + '.': [ + { + title: '不安全资讯', + docs: 'http://docs.rsshub.app/new-media.html#bu-an-quan', + source: '/', + target: '/buaq', + }, + ], + }, + 'jian-ning.com': { + _name: '建宁闲谈', + '.': [ + { + title: '文章', + docs: 'https://docs.rsshub.app/blog.html#jian-ning-xian-tan', + source: '/*', + target: '/blogs/jianning', + }, + ], + }, + 'matataki.io': { + _name: 'matataki', + www: [ + { + title: '最热作品', + docs: 'https://docs.rsshub.app/new-media.html#matataki', + source: '/article/', + target: '/matataki/posts/hot', + }, + { + title: '最新作品', + docs: 'https://docs.rsshub.app/new-media.html#matataki', + source: '/article/latest', + target: '/matataki/posts/latest', + }, + { + title: '作者创作', + docs: 'https://docs.rsshub.app/new-media.html#matataki', + source: '/user/:uid', + target: (params) => `/matataki/users/${params.uid}/posts`, + }, + { + title: 'Fan票关联作品', + docs: 'https://docs.rsshub.app/new-media.html#matataki', + source: ['/token/:tokenId', '/token/:tokenId/circle'], + target: (params) => `/matataki/tokens/${params.tokenId}/posts`, + }, + { + title: '标签关联作品', + docs: 'https://docs.rsshub.app/new-media.html#matataki', + source: ['/tag/:tagId'], + target: (params, url) => { + const tagName = new URL(url).searchParams.get('name'); + return `/matataki/tags/${params.tagId}/${tagName}/posts`; + }, + }, + { + title: '收藏夹', + docs: 'https://docs.rsshub.app/new-media.html#matataki', + source: '/user/:uid/favlist/:fid', + target: (params) => `/matataki/users/${params.uid}/favorites/${params.fid}/posts`, + }, + ], + }, + 'eventernote.com': { + _name: 'Eventernote', + www: [ + { + title: '声优活动及演唱会', + docs: 'https://docs.rsshub.app/anime.html#eventernote', + source: '/actors/:name/:id/events', + target: '/eventernote/actors/:name/:id', + }, + ], + }, + 'instagram.com': { + _name: 'Instagram', + www: [ + { + title: '用户', + docs: 'https://docs.rsshub.app/social-media.html#instagram', + source: '/:id', + target: (params) => { + if (params.id !== 'explore' && params.id !== 'developer') { + return '/instagram/user/:id'; + } + }, + }, + ], + }, + 'huya.com': { + _name: '虎牙直播', + '.': [ + { + title: '直播间开播', + docs: 'https://docs.rsshub.app/live.html#hu-ya-zhi-bo-zhi-bo-jian-kai-bo', + source: '/:id', + target: '/huya/live/:id', + }, + ], + }, + 'craigslist.org': { + _name: 'Craigslist', + '.': [ + { + title: '商品搜索列表', + docs: 'https://docs.rsshub.app/shopping.html#craigslist', + }, + ], + }, + 'saraba1st.com': { + _name: 'Saraba1st', + bbs: [ + { + title: '帖子', + docs: 'https://docs.rsshub.app/bbs.html#saraba1st', + source: '/2b/:id', + target: (params) => { + const id = params.id.includes('thread') ? params.id.split('-')[1] : ''; + return id ? `/saraba1st/thread/${id}` : ''; + }, + }, + ], + }, }); diff --git a/docs/.format/chineseFormat.js b/docs/.format/chineseFormat.js new file mode 100644 index 000000000..dd48242a3 --- /dev/null +++ b/docs/.format/chineseFormat.js @@ -0,0 +1,27 @@ +const file = require('./file'); +const width = require('string-width'); +const remark = require('remark'); +const pangu = require('remark-pangu'); +const frontmatter = require('remark-frontmatter'); + +const prettier = require('remark-preset-prettier'); + +module.exports = { + rules: (list) => list.filter((e) => e.lang === file.LANG_CN), + handler: async (doc) => { + let result = await remark() + .use(frontmatter) + .use(pangu, { + inlineCode: false, + link: false, + }) + .use(prettier) + .use({ + settings: { + stringLength: width, + }, + }) + .process(doc); + return typeof result === 'string' ? result : typeof result.contents === 'string' ? result.contents : result.result; + }, +}; diff --git a/docs/.format/file.js b/docs/.format/file.js new file mode 100644 index 000000000..8e5516561 --- /dev/null +++ b/docs/.format/file.js @@ -0,0 +1,11 @@ +const fs = require('fs'); + +module.exports = { + ROUTE_TYPE: 'route', + GUIDE_TYPE: 'guide', + NAV_TYPE: 'nav', + LANG_CN: 'zh-CN', + LANG_EN: 'en-US', + readFile: async (filePath) => fs.promises.readFile(filePath, { encoding: 'utf8' }), + writeFile: async (filePath, data) => fs.promises.writeFile(filePath, data, { encoding: 'utf8' }), +}; diff --git a/docs/.format/format.js b/docs/.format/format.js new file mode 100644 index 000000000..081aa0258 --- /dev/null +++ b/docs/.format/format.js @@ -0,0 +1,113 @@ +const file = require('./file'); +const sgf = require('staged-git-files'); +const path = require('path'); +const sortByHeading = require('./sortByHeading'); +const chineseFormat = require('./chineseFormat'); +const util = require('util'); +const exec = util.promisify(require('child_process').exec); + +/** + * Processors are objects contains two methods: + * `rules(list)`, and `handler(str)` + * rules filters required file document object + * and handler get document string and return formatted document + */ +const processors = [sortByHeading, chineseFormat]; + +// Helpers +const loopSideBar = (children, type, lang, prefix) => + children + .filter((e) => e !== '') + .map((x) => ({ + path: path.resolve(__dirname, '..', prefix, `./${x}.md`), + type, + lang, + })); +const loopNav = (nav, lang) => + nav.map((e) => ({ + path: path.resolve(__dirname, '..', e.link.slice(1), 'README.md'), + type: file.NAV_TYPE, + lang, + })); +const loopType = (sidebar, lang, prefix) => loopSideBar(sidebar[0].children, file.GUIDE_TYPE, lang, prefix).concat(loopSideBar(sidebar[1].children, file.ROUTE_TYPE, lang, prefix)); + +/** + * Iterate config and build document object: + * E.g. + * { + path: 'docs/en/other.md', <-- full path here + type: 'route', <--- Defined in file.js + lang: 'en' <-- Defined in file.js + } + */ +const buildFileList = async () => { + const config = require(`../.vuepress/config`); + let fileList = []; + Object.keys(config.themeConfig.locales).forEach((key) => { + const locale = config.themeConfig.locales[key]; + const key_path = key.slice(1); + if (locale.hasOwnProperty('sidebar')) { + fileList = fileList.concat(loopType(locale.sidebar[key], locale.lang, key_path)); + } + if (locale.hasOwnProperty('nav')) { + fileList = fileList.concat(loopNav(locale.nav, locale.lang)); + } + }); + + return fileList; +}; + +/** + * Select files that only being modified + * Same format as `buildFileList()` + */ +const buildStagedList = async () => { + const stagedFiles = await sgf(); + const stagedFileList = []; + stagedFiles.forEach((e) => { + if (e.filename.endsWith('.md')) { + stagedFileList.push(e.filename); + } + }); + const fullFileList = await buildFileList(); + const result = []; + stagedFileList.forEach((e) => { + const f = fullFileList.find((x) => x.path.indexOf(e) !== -1); + if (f) { + result.push(f); + } + }); + + return result; +}; + +/** Entry + * Usage: node format.js --full/--staged + */ +(async () => { + // Mode + const flag = process.argv[2] || '--full'; + let fileList = []; + switch (flag) { + case '--staged': + fileList = await buildStagedList(); + break; + case '--full': + default: + fileList = await buildFileList(); + } + // console.log(fileList); + // return + + const stagedFiles = await sgf(); + for (const processor of processors) { + for (const e of processor.rules(fileList)) { + let formatted = await file.readFile(e.path); + formatted = await processor.handler(formatted); + await file.writeFile(e.path, formatted); + if (stagedFiles.find((x) => e.path.indexOf(x.filename) !== -1)) { + await exec(`git add ${e.path}`); + } + } + } +})(); diff --git a/docs/.format/md/hierarchySlug.js b/docs/.format/md/hierarchySlug.js new file mode 100644 index 000000000..fdbbd9f2a --- /dev/null +++ b/docs/.format/md/hierarchySlug.js @@ -0,0 +1,126 @@ +// A fork of https://github.com/valeriangalliat/markdown-it-anchor +const slugify = (s) => encodeURIComponent(String(s).trim().toLowerCase().replace(/\s+/g, '-')); + +const position = { + false: 'push', + true: 'unshift', +}; + +const hasProp = Object.prototype.hasOwnProperty; + +const permalinkHref = (slug) => `#${slug}`; +const permalinkAttrs = (slug) => ({}); + +const renderPermalink = (slug, opts, state, idx) => { + const space = () => Object.assign(new state.Token('text', '', 0), { content: ' ' }); + + const linkTokens = [ + Object.assign(new state.Token('link_open', 'a', 1), { + attrs: [['class', opts.permalinkClass], ['href', opts.permalinkHref(slug, state)], ...Object.entries(opts.permalinkAttrs(slug, state))], + }), + Object.assign(new state.Token('html_block', '', 0), { + content: opts.permalinkSymbol, + }), + new state.Token('link_close', 'a', -1), + ]; + + // `push` or `unshift` according to position option. + // Space is at the opposite side. + if (opts.permalinkSpace) { + linkTokens[position[!opts.permalinkBefore]](space()); + } + state.tokens[idx + 1].children[position[opts.permalinkBefore]](...linkTokens); +}; + +const uniqueSlug = (slug, slugs, failOnNonUnique) => { + let uniq = slug; + let i = 2; + if (failOnNonUnique && hasProp.call(slugs, uniq)) { + throw Error(`User defined id attribute '${slug}' is NOT unique. Please fix it in your markdown to continue.`); + } else { + while (hasProp.call(slugs, uniq)) uniq = `${slug}-${i++}`; + } + slugs[uniq] = true; + return uniq; +}; + +const isLevelSelectedNumber = (selection) => (level) => level >= selection; +const isLevelSelectedArray = (selection) => (level) => selection.includes(level); + +const getTitle = (children) => children.filter((token) => token.type === 'text' || token.type === 'code_inline').reduce((acc, t) => acc + t.content, ''); + +const anchor = (md, opts) => { + opts = Object.assign({}, anchor.defaults, opts); + + md.core.ruler.push('anchor', (state) => { + const slugs = {}; + const tokens = state.tokens; + + const isLevelSelected = Array.isArray(opts.level) ? isLevelSelectedArray(opts.level) : isLevelSelectedNumber(opts.level); + + for (let i = 0; i < tokens.length; i++) { + const currentLevel = tokens[i].markup.length; + if (tokens[i].type === 'heading_open' && isLevelSelected(currentLevel)) { + const titleIndex = i + 1; + const currentTitle = getTitle(tokens[titleIndex].children); + let prevTitle = tokens[i].attrGet('id'); + let constructedTitle = prevTitle; + + // Skip if user has defined a id + if (typeof prevTitle !== 'string') { + if (prevTitle === null) { + prevTitle = []; + } + + let recurIndex = i + 2; + while (recurIndex < tokens.length && (tokens[recurIndex].type !== 'heading_open' || tokens[recurIndex].markup.length > currentLevel)) { + if (tokens[recurIndex].type === 'heading_open') { + let recurPrevTitle = tokens[recurIndex].attrGet('id'); + if (typeof recurPrevTitle !== 'string') { + if (recurPrevTitle === null) { + recurPrevTitle = []; + } + recurPrevTitle = [...recurPrevTitle, currentTitle]; + tokens[recurIndex].attrSet('id', recurPrevTitle); + } + } + recurIndex += 1; + } + + prevTitle.push(currentTitle); + //console.log(prevTitle); + + // @TODO maybe use previous slugified title so we don't need to calculate that much? + constructedTitle = prevTitle.join('-'); + //console.log(constructedTitle); + } + + const slug = uniqueSlug(opts.slugify(constructedTitle), slugs, true); + tokens[i].attrSet('id', slug); + + if (opts.permalink) { + opts.renderPermalink(slug, opts, state, i); + } + + if (opts.callback) { + opts.callback(tokens[i], { slug, constructedTitle }); + } + } + } + }); +}; + +anchor.defaults = { + level: 1, + slugify, + permalink: false, + renderPermalink, + permalinkClass: 'header-anchor', + permalinkSpace: true, + permalinkSymbol: '¶', + permalinkBefore: false, + permalinkHref, + permalinkAttrs, +}; + +module.exports = anchor; diff --git a/docs/.format/sortByHeading.js b/docs/.format/sortByHeading.js new file mode 100644 index 000000000..784824e2c --- /dev/null +++ b/docs/.format/sortByHeading.js @@ -0,0 +1,57 @@ +const file = require('./file'); +const pinyin = require('pinyin'); + +const isASCII = (str) => /^[\x00-\x7F]*$/.test(str); + +module.exports = { + rules: (list) => list.filter((e) => e.type === file.ROUTE_TYPE), + handler: async (data) => { + const content = data.split('\n'); + const blocks = []; + const h1 = []; + + let i = 0; + while (i < content.length) { + const m = /^##\s*(.*)$/.exec(content[i]); + if (m) { + const b = { + title: m[1], + content: [], + }; + + b.content.push(content[i]); + i++; + while (i < content.length && !/^##\s.*$/.test(content[i])) { + b.content.push(content[i]); + i++; + } + blocks.push(b); + } else { + h1.push(content[i]); + i++; + } + } + + let newContent = blocks + .sort((a, b) => { + const ia = isASCII(a.title[0]); + const ib = isASCII(b.title[0]); + if (ia && ib) { + return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : 1; + } else if (ia || ib) { + return ia > ib ? -1 : 1; + } else { + return pinyin.compare(a.title, b.title); + } + }) + .map((x) => x.content.join('\n')) + .join('\n'); + if (newContent) { + h1.push(newContent); + } + + newContent = h1.join('\n'); + + return Promise.resolve(newContent); + }, +}; diff --git a/docs/.vuepress/components/Route.vue b/docs/.vuepress/components/Route.vue index 7c513f059..a83a40db5 100644 --- a/docs/.vuepress/components/Route.vue +++ b/docs/.vuepress/components/Route.vue @@ -1,13 +1,13 @@