diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 485990eb7..a7c9da72d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -40,10 +40,10 @@ "onCreateCommand": "sudo apt-get update && export DEBIAN_FRONTEND=noninteractive && sudo apt-get -y install --no-install-recommends ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 wget xdg-utils redis-server && sudo apt-get autoremove -y && sudo apt-get clean -y && sudo rm -rf /var/lib/apt/lists/*", - "updateContentCommand": "pnpm i && pnpm i -C website && pnpm rb", + "updateContentCommand": "pnpm i && pnpm rb", // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pnpm i && pnpm i -C website && pnpm rb", + "postCreateCommand": "pnpm i && pnpm rb", // Disable auto start dev env since codespaces sometimes fails to attach to the terminal // "postAttachCommand": { diff --git a/.dockerignore b/.dockerignore index 3c46a06f7..1b633a2d9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,7 +11,6 @@ app-minimal coverage node_modules test -website # files .codecov.yml diff --git a/.eslintignore b/.eslintignore index b28531c34..5b176d430 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,4 +3,3 @@ coverage docker-compose.yml !/.github !/docs/.vuepress -website diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0a5d8d95b..cb51da840 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -36,19 +36,6 @@ updates: - dependency-name: unist-util-visit-parents versions: ['>=6.0.0'] - - package-ecosystem: npm - directory: '/website' - schedule: - interval: daily - time: '21:00' - open-pull-requests-limit: 10 - labels: - - dependencies - groups: - docusaurus: - patterns: - - '@docusaurus/*' - - package-ecosystem: 'github-actions' directory: '/' schedule: diff --git a/.github/workflows/docs-search-index.yml b/.github/workflows/docs-search-index.yml deleted file mode 100644 index 7e5f0b346..000000000 --- a/.github/workflows/docs-search-index.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Update meilisearch index - -on: - push: - branches: - - master - paths: - - '.github/workflows/docs-search-index.yml' - - 'scripts/docs-scraper/docs.rsshub.app.json' - - 'website/**' - workflow_dispatch: {} - schedule: - - cron: '44 1 * * 1' - -permissions: - contents: read - -concurrency: - group: docs-search-index - -jobs: - scrape-docs: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Pull image - run: docker pull getmeili/docs-scraper - - name: Wait for Netlify to finish - run: sleep 2m - if: github.event_name == 'push' - - name: Run docs-scraper - timeout-minutes: 30 - env: - HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} - API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} - CONFIG_FILE_PATH: ${{ github.workspace }}/scripts/docs-scraper/docs.rsshub.app.json - run: | - docker run -t --rm \ - -e MEILISEARCH_HOST_URL=$HOST_URL \ - -e MEILISEARCH_API_KEY=$API_KEY \ - -v $CONFIG_FILE_PATH:/docs-scraper/config.json \ - getmeili/docs-scraper pipenv run ./docs_scraper config.json - - name: Swap index - env: - HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} - API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} - run: | - curl \ - -X POST $HOST_URL/swap-indexes \ - -H "Authorization: Bearer $API_KEY" \ - -H 'Content-Type: application/json' \ - -d '[{"indexes":["rsshub","rsshub-tmp"]}]' - - name: Delete old index - env: - HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }} - API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} - run: | - curl \ - -X DELETE $HOST_URL/indexes/rsshub-tmp \ - -H "Authorization: Bearer $API_KEY" diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index b8006072a..7bbe9209b 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -30,8 +30,6 @@ jobs: node-version: lts/* cache: 'pnpm' - run: pnpm i - - run: pnpm i - working-directory: website - run: npm run format - name: Commit files run: | diff --git a/.gitpod.yml b/.gitpod.yml index 039f632e3..0afafdad3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -14,7 +14,7 @@ tasks: sudo apt update sudo apt install -y ca-certificates fonts-liberation libasound2 libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libgbm1 libglib2.0-0 libnspr4 libnss3 libpango-1.0-0 libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxkbcommon0 libxrandr2 wget xdg-util sudo apt install -y redis-server - init: pnpm i && pnpm i -C website && pnpm rb + init: pnpm i && pnpm rb - name: app command: pnpm run dev openMode: tab-after diff --git a/.prettierignore b/.prettierignore index 8ee16a7bc..b4a96659f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,4 +5,3 @@ package-lock.json renovate.json coverage .vscode/ -website diff --git a/vitest.config.ts b/vitest.config.ts index a55ba6225..2a4074bea 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, defaultExclude } from 'vitest/config'; +import { defineConfig } from 'vitest/config'; import tsconfigPaths from 'vite-tsconfig-paths'; export default defineConfig({ @@ -10,6 +10,5 @@ export default defineConfig({ exclude: ['lib/routes/**', 'lib/routes-deprecated/**'], }, testTimeout: 10000, - exclude: ['website', ...defaultExclude], }, }); diff --git a/website/.editorconfig b/website/.editorconfig deleted file mode 100644 index d1d8a4176..000000000 --- a/website/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/website/.gitignore b/website/.gitignore deleted file mode 100644 index b2d6de306..000000000 --- a/website/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -# Dependencies -/node_modules - -# Production -/build - -# Generated files -.docusaurus -.cache-loader - -# Misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* diff --git a/website/README.md b/website/README.md deleted file mode 100644 index 36e55f9c8..000000000 --- a/website/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# Website - -This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator. - -## Installation - -``` -$ pnpm -``` - -## Local Development - -``` -$ pnpm start -``` - -This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server. - -## Build - -``` -$ pnpm build -``` - -This command generates static content into the `build` directory and can be served using any static contents hosting service. - -## Deployment - -Using SSH: - -``` -$ USE_SSH=true pnpm deploy -``` - -Not using SSH: - -``` -$ GIT_USER= pnpm deploy -``` - -If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. diff --git a/website/babel.config.cjs b/website/babel.config.cjs deleted file mode 100644 index 0adade1fb..000000000 --- a/website/babel.config.cjs +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], -}; diff --git a/website/docs/README.md b/website/docs/README.md deleted file mode 100644 index 02eafc471..000000000 --- a/website/docs/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Introduction - -

- RSSHub -

-

RSSHub

- -> 🧡 Everything is RSSible - -[![](https://img.shields.io/badge/dynamic/json?url=https://rsshub-analytics.diygod.workers.dev/&query=requests&color=F38020&label=requests&logo=cloudflare&style=flat-square&suffix=/month)](https://rsshub.app) -[![docker publish](https://img.shields.io/docker/pulls/diygod/rsshub?label=docker%20pulls&logo=docker&style=flat-square)](https://hub.docker.com/r/diygod/rsshub) -[![npm publish](https://img.shields.io/npm/dt/rsshub?label=npm%20downloads&logo=npm&style=flat-square)](https://www.npmjs.com/package/rsshub) -[![test](https://img.shields.io/github/actions/workflow/status/DIYgod/RSSHub/test.yml?branch=master&label=test&logo=github&style=flat-square)](https://github.com/DIYgod/RSSHub/actions/workflows/test.yml?query=event%3Apush+branch%3Amaster) -[![Test coverage](https://img.shields.io/codecov/c/github/DIYgod/RSSHub.svg?style=flat-square&logo=codecov)](https://app.codecov.io/gh/DIYgod/RSSHub/branch/master) - -[![Telegram group](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.swo.moe%2Fstats%2Ftelegram%2Frsshub&query=count&color=2CA5E0&label=Telegram%20Group&logo=telegram&cacheSeconds=3600&style=flat-square)](https://t.me/rsshub) [![Telegram channel](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fapi.swo.moe%2Fstats%2Ftelegram%2FawesomeRSSHub&query=count&color=2CA5E0&label=Telegram%20Channel&logo=telegram&cacheSeconds=3600&style=flat-square)](https://t.me/awesomeRSSHub) [![Twitter](https://img.shields.io/badge/any_text-Follow-blue?color=2CA5E0&label=Twitter&logo=twitter&cacheSeconds=3600&style=flat-square)](https://twitter.com/intent/follow?screen_name=_RSSHub) - -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 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) and mobile auxiliary app [RSSBud](https://github.com/Cay-Zhang/RSSBud) (iOS) and [RSSAid](https://github.com/LeetaoGoooo/RSSAid) (Android) - -[Telegram Group](https://t.me/rsshub) | [Telegram Channel](https://t.me/awesomeRSSHub) | [Twitter](https://twitter.com/intent/follow?screen_name=_RSSHub) - -## Special Thanks - -### Special Sponsors - -

- - -

- -[![](https://opencollective.com/static/images/become_sponsor.svg)](https://docs.rsshub.app/support/) - -### Contributors - -

- -

- -Logo designer [sheldonrrr](https://dribbble.com/sheldonrrr) - -### Backers - - - - - -## Related Projects - -- [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) | A browser extension that can help you quickly discover and subscribe to the RSS and RSSHub of current websites. -- [RSSBud](https://github.com/Cay-Zhang/RSSBud) | RSSHub Radar for iOS platform, designed specifically for mobile ecosystem optimization. -- [RSSAid](https://github.com/LeetaoGoooo/RSSAid) | RSSHub Radar for Android platform built with Flutter. -- [DocSearch](https://github.com/Fatpandac/DocSearch) | Link RSSHub DocSearch into Raycast diff --git a/website/docs/api.md b/website/docs/api.md deleted file mode 100644 index 18d89ef64..000000000 --- a/website/docs/api.md +++ /dev/null @@ -1,11 +0,0 @@ -# API - -:::warning - -The API is under active development and is subject to change. All suggestions are welcome! - -::: - -RSSHub provides the following APIs: - -https://rsshub.app/api/ui diff --git a/website/docs/faq.md b/website/docs/faq.md deleted file mode 100644 index 248c75903..000000000 --- a/website/docs/faq.md +++ /dev/null @@ -1,27 +0,0 @@ -# FAQs - -import Translate from '@docusaurus/Translate'; - -**Q: How does RSSHub work?** - -**A:** When a request is received, RSSHub fetches the corresponding data from the original site, the resulting contents will be outputted in RSS format. Caching is implemented to avoid requesting original sites for content. And of course, we throw in a little magic 🎩. - -**Q: Can I use the demo instance?** - -**A:** [rsshub.app](https://rsshub.app) is the demo instance provided, running the latest build of RSSHub from master branch, the cache is set 120 minutes and it's free to use. However, if you see an badge for route, this means popular websites such as Facebook etc. may pose a request quota on individual IP address, which means it can get unreliable from time to time for the demo instance. You are encouraged to [host your own RSSHub instance](/install/) to get a better usability. - -**Q: Why are images/videos not loading in some RSSHub routes?** - -**A:** RSSHub fetches and respects the original image/video URLs from original sites, in which some are behind anti-hotlink filters. `referrerpolicy="no-referrer"` attribute is added to all images to solve the issues caused by cross-domain requests. Third party RSS service providers such as Feedly and Inoreader, strip this attribute off, resulting in cross-domain requests being blocked. Meanwhile, the attribute is not available for videos yet, resulting in most RSS readers unable to pass the anti-hotlink check. Here are some workarounds: - -1. Migrate to RSS readers that do not send Referer,such as [Inoreader for Web](https://www.inoreader.com/) with a [user script disabling Referer](https://greasyfork.org/en/scripts/376884), [fix-image-error at inoreader](https://greasyfork.org/scripts/463461-fix-image-error-at-inoreader), [RSS to Telegram Bot](https://github.com/Rongronggg9/RSS-to-Telegram-Bot), etc. If your RSS reader can bypass the anti-hotlink check successfully and play embedded videos, it's an RSS reader that do not send Referer. Please consider adding it to the documentation to help more people. -2. Set up a reverse proxy, refer to [Parameters->Multimedia processing](/parameter#multimedia-processing) for more details. -3. Navigate back to the original site. - -**Q: The website I want is not supported QAQ** - -**A:** If you are a JavaScript developer, please follow [this guide](/joinus/quick-start) for submitting a pull request, otherwise, follow the issue template to [submit a new issue](https://github.com/DIYgod/RSSHub/issues/new?template=rss_request_en.md), and patiently wait for Santa Claus. For priority responses, consider [sponsoring us](/support). - -**Q: Where do I get the changelog for RSSHub?** - -**A:** Subscribe our RSS here: [RSSHub added a new route](/routes/program-update#rsshub). diff --git a/website/docs/install/README.md b/website/docs/install/README.md deleted file mode 100644 index f493dbb0e..000000000 --- a/website/docs/install/README.md +++ /dev/null @@ -1,634 +0,0 @@ ---- -sidebar: auto ---- - -# Deployment - -RSSHub provides a painless deployment process if you are equipped with basic programming knowledge, you may open an [issue](https://github.com/DIYgod/RSSHub/issues/new/choose) if you believe you have encountered a problem not listed [here](https://github.com/DIYgod/RSSHub/issues), the community will try to sort it out asap. - -The deployment may involve the followings: - -1. Command line interface -2. [Git](https://git-scm.com/) -3. [Node.js](https://nodejs.org/) -4. [npm](https://www.npmjs.com/get-npm) or [yarn](https://yarnpkg.com/zh-Hans/docs/install) - -Deploy for public access may require: - -1. [Nginx](https://www.nginx.com/resources/wiki/start/topics/tutorials/install/) -2. [Docker](https://www.docker.com/get-started) or [docker-compose](https://docs.docker.com/compose/install/) -3. [Redis](https://redis.io/download) -4. [Heroku](https://devcenter.heroku.com/articles/getting-started-with-nodejs) -5. [Google App Engine](https://cloud.google.com/appengine/) -6. [Fly.io](https://fly.io/) -7. [Zeabur](https://zeabur.com) -8. [Sealos](https://sealos.io) - -## Docker Image - -We recommend using the latest version `diygod/rsshub` (i.e. `diygod/rsshub:latest`) of the docker image. - -When the latest version is unstable, you can use the image with a date tag for temporary use. For example: - -```bash -$ docker pull diygod/rsshub:2021-06-18 -``` - -You can back to the latest version when the code has been fixed and rebuild the image. - -To enable puppeteer, `diygod/rsshub:chromium-bundled` is a good choice. If date specified, it will become: `diygod/rsshub:chromium-bundled-2021-06-18`. - -Another approach to enable puppeteer is deploying with Docker Compose. However, it consumes more disk space and memory. By modifying `docker-compose.yml`, you can use `diygod/rsshub:chromium-bundled` instead to reduce the disk space and memory consumption. - -## Docker Compose Deployment - -### Install - -Download [docker-compose.yml](https://github.com/DIYgod/RSSHub/blob/master/docker-compose.yml) - -```bash -$ wget https://raw.githubusercontent.com/DIYgod/RSSHub/master/docker-compose.yml -``` - -Check if any configuration needs to be changed - -```bash -$ vi docker-compose.yml # or your favorite editor -``` - -Create a docker volume to persist Redis caches - -```bash -$ docker volume create redis-data -``` - -Launch - -```bash -$ docker-compose up -d -``` - -### Update - -Remove old containers - -```bash -$ docker-compose down -``` - -Repull the latest image if you have downloaded the image before. It is helpful to resolve some issues. - -```bash -$ docker pull diygod/rsshub -``` - -Then repeat the installation steps - -### Configuration - -Edit `environment` in [docker-compose.yml](https://github.com/DIYgod/RSSHub/blob/master/docker-compose.yml) - -## Docker Deployment - -:::tip - -To enable puppeteer, replace `diygod/rsshub` with `diygod/rsshub:chromium-bundled` in **EACH** command. - -::: - -### Install - -Execute the following command to pull RSSHub's docker image. - -```bash -$ docker pull diygod/rsshub -``` - -Start an RSSHub container - -```bash -$ docker run -d --name rsshub -p 1200:1200 diygod/rsshub -``` - -Visit [http://127.0.0.1:1200](http://127.0.0.1:1200), and enjoy it! ✅ - -Execute the following command to stop `RSSHub`. - -```bash -$ docker stop rsshub -``` - -### Update - -Remove the old container - -```bash -$ docker stop rsshub -$ docker rm rsshub -``` - -Then repeat the installation steps - -### Configuration - -The simplest way to configure RSSHub container is via system environment variables. - -For example, adding `-e CACHE_EXPIRE=3600` will set the cache time to 1 hour. - -```bash -$ docker run -d --name rsshub -p 1200:1200 -e CACHE_EXPIRE=3600 -e GITHUB_ACCESS_TOKEN=example diygod/rsshub -``` - -This deployment method does not include puppeteer (unless using `diygod/rsshub:chromium-bundled` instead) and Redis dependencies. Use the Docker Compose deployment method or deploy external dependencies yourself if you need it. - -To configure more options please refer to [Configuration](#configuration). - -## Kubernetes Deployment (Helm) - -RSSHub can be installed in Kubernetes using the Helm Chart from [RSSHub Helm Chart](https://github.com/NaturalSelectionLabs/helm-charts/tree/main/charts/rsshub) - -Ensure that the following requirements are met: - -- Kubernetes 1.16+ -- Helm version 3.9+ is [installed](https://helm.sh/docs/intro/install/) - -### Install - -Add NaturalSelection Labs chart repository to Helm: - -```bash -helm repo add nsl https://naturalselectionlabs.github.io/helm-charts -``` - -You can update the chart repository by running: - -```bash -helm repo update -``` - -And install it with the `helm` command line: - -```bash -helm install my-release nsl/rsshub -``` - -### Update - -To upgrade the my-release RSSHub deployment: - -```bash -helm upgade my-release nsl/rsshub -``` - -### Uninstall - -To uninstall/delete the my-release RSSHub deployment: - -```bash -helm delete my-release -``` - -### Installing with custom values - - - - -```bash -helm install my-release nsl/rsshub \ - --set="image.tag=2023-12-04" \ - --set="replicaCount=2" -``` - - - - -```yaml -# File custom-values.yml -## Install with "helm install my-release nsl/rsshub -f ./custom-values.yml -image: - tag: "2023-12-04" -replicaCount: 2 -``` - - - - -### Install with HA mode - - - - -```yaml -replicaCount: 3 - -puppeteer: - replicaCount: 2 -``` - - - - -```yaml -autoscaling: - enabled: true - minReplicas: 3 - -puppeteer: - autoscaling: - enabled: true - minReplicas: 2 -``` - - - - -### Install with external Redis - -```yaml -redis: - # -- Disable internal redis - enabled: false -env: - # -- other env -- - REDIS_URL: redis://external-redis:6379/ -``` - -To configure more values please refer to [RSSHub Helm Chart](https://github.com/NaturalSelectionLabs/helm-charts/tree/main/charts/rsshub). - -## Ansible Deployment - -This Ansible playbook includes RSSHub, Redis, browserless (uses Docker) and Caddy 2 - -Currently only support Ubuntu 20.04 - -Requires sudo privilege and virtualization capability (Docker will be automatically installed) - -### Install - -```bash -sudo apt update -sudo apt install ansible -git clone https://github.com/DIYgod/RSSHub.git ~/RSSHub -cd ~/RSSHub/scripts/ansible -sudo ansible-playbook rsshub.yaml -# When prompt to enter a domain name, enter the domain name that this machine/VM will use -# For example, if your users use https://rsshub.example.com to access your RSSHub instance, enter rsshub.example.com (remove the https://) -``` - -### Update - -```bash -cd ~/RSSHub/scripts/ansible -sudo ansible-playbook rsshub.yaml -# When prompt to enter a domain name, enter the domain name that this machine/VM will use -# For example, if your users use https://rsshub.example.com to access your RSSHub instance, enter rsshub.example.com (remove the https://) -``` - -## Manual Deployment - -The most direct way to deploy `RSSHub`, you can follow the steps below to deploy`RSSHub` on your computer, server or anywhere. - -### Install - -Execute the following commands to download the source code - -```bash -$ git clone https://github.com/DIYgod/RSSHub.git -$ cd RSSHub -``` - -Execute the following commands to install dependencies (Do not add the `--production` parameter for development). - - - - -```bash -pnpm install --prod -``` - - - - -```bash -yarn --production -``` - - - - -```bash -npm install --omit=dev -``` - - - - -### Launch - -Under `RSSHub`'s root directory, execute the following commands to launch - - - - -```bash -pnpm start -``` - - - - -```bash -$ yarn start -``` - - - - -```bash -$ npm start -``` - - - - -Or use [PM2](https://pm2.io/docs/plus/quick-start/) - -```bash -$ pm2 start lib/index.js --name rsshub -``` - -Visit [http://127.0.0.1:1200/](http://127.0.0.1:1200/), and enjoy it! ✅ - -Refer to our [Guide](https://docs.rsshub.app/) for usage. Replace `https://rsshub.app/` with `http://localhost:1200` in any route example to see the effect. - -### Configuration - -:::tip - -On arm/arm64, this deployment method does not include puppeteer dependencies. To enable puppeteer, install Chromium from your distribution repositories first, then set `CHROMIUM_EXECUTABLE_PATH` to its executable path. - -Debian: - -```bash -$ apt install chromium -$ echo >> .env -$ echo 'CHROMIUM_EXECUTABLE_PATH=chromium' >> .env -``` - -Ubuntu/Raspbian: - -```bash -$ apt install chromium-browser -$ echo >> .env -$ echo 'CHROMIUM_EXECUTABLE_PATH=chromium-browser' >> .env -``` - -::: - -RSSHub can be configured by setting environment variables. - -Create a `.env` file in the root directory of your project. Add environment-specific variables on new lines in the form of `NAME=VALUE`. For example: - -``` -CACHE_TYPE=redis -CACHE_EXPIRE=600 -``` - -Please notice that it will not override already existed environment variables, more rules please refer to [dotenv](https://github.com/motdotla/dotenv) - -This deployment method does not include Redis dependencies. Use the Docker Compose deployment method or deploy external dependencies yourself if you need it. - -To configure more options please refer to [Configuration](#configuration). - -### Update - -Under `RSSHub`'s directory, execute the following commands to pull the latest source code for `RSSHub` - -```bash -$ git pull -``` - -Then repeat the installation steps. - -### A tip for Nix users - -To install nodejs, yarn and jieba (to build documentation) you can use the following `nix-shell` configuration script. - -```nix -let - pkgs = import {}; - node = pkgs.nodejs-12_x; -in pkgs.stdenv.mkDerivation { - name = "nodejs-yarn-jieba"; - buildInputs = [node pkgs.yarn pkgs.pythonPackages.jieba]; -} -``` - -## Deploy to Railway - -Automatic updates are included. - -[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/QxW__f?referralCode=9wT3hc) - -## Deploy to Heroku - -### Notice - -:::warning Update - -Heroku [no longer](https://blog.heroku.com/next-chapter) offers free product plans. - -::: - -~~Heroku accounts with unverified payment methods have only 550 hours of credit per month (about 23 days), and up to 1,000 hours per month with verified payment methods.~~ - -### Instant deploy (without automatic update) - -[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https%3A%2F%2Fgithub.com%2FDIYgod%2FRSSHub) - -### Automatic deploy upon update - -1. [Fork RSSHub](https://github.com/DIYgod/RSSHub/fork) to your GitHub account. -2. Deploy your fork to Heroku: `https://heroku.com/deploy?template=URL`, where `URL` is your fork address (_e.g._ `https://github.com/USERNAME/RSSHub`). -3. Configure `automatic deploy` in Heroku app to follow the changes to your fork. -4. Install [Pull](https://github.com/apps/pull) app to keep your fork synchronized with RSSHub. - -## Deploy to Sealos(use Redis as cache) - -Automatic updates are included. - -[![Deploy to Sealos](https://raw.githubusercontent.com/labring-actions/templates/main/Deploy-on-Sealos.svg)](https://template.cloud.sealos.io/deploy?templateName=rsshub) - -## Deploy to Vercel (ZEIT Now) - -### Instant deploy (without automatic update) - -[![Deploy to Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/DIYgod/RSSHub) - -### Automatic deploy upon update - -1. [Fork RSSHub](https://github.com/DIYgod/RSSHub/fork) to your GitHub account. -2. Deploy your fork to Vercel: Login Vercel with your GitHub account, create and deploy [new Vercel project](https://vercel.com/new/) with your RSSHub repository. -3. Install [Pull](https://github.com/apps/pull) app to keep your fork synchronized with RSSHub. - -## Deploy to Fly.io - -### Method 1: Fork - -1. [Fork RSSHub](https://github.com/DIYgod/RSSHub/fork) to your GitHub account; -2. Clone the source code from your fork - - ```bash - $ git clone https://github.com//RSSHub.git - $ cd RSSHub - ``` - -3. [Sign up for Fly.io](https://fly.io/app/sign-up) and install the [flyctl CLI](https://fly.io/docs/hands-on/install-flyctl/); -4. Run `fly launch` and choose a unique name and region to deploy; -5. Use `fly secrets set KEY=VALUE` to [configure some modules](#configuration-route-specific-configurations); -6. [Set up automatic deployment via GitHub Actions](https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/); -7. (Optional) Use `fly certs add your domain` to configure a custom domain, and follow the instructions to configure the related domain resolution at your DNS service provider (you can check the domain configuration status on the Dashboard Certificate page). - -Upgrade: On the homepage of your Forked repository, click "Sync fork - Update Branch" to manually update to the latest official master branch, or install the [Pull](https://github.com/apps/pull) GitHub app to keep your fork synchronized with upstream. - -### Method 2: Maintain fly.toml by yourself - -1. [Sign up for Fly.io](https://fly.io/app/sign-up) and install the [flyctl CLI](https://fly.io/docs/hands-on/install-flyctl/); -2. Create a new empty directory locally, run `fly launch` in it, and choose a unique name and instance region; -3. Edit the generated fly.toml file, add - - ```toml - [build] - image = "diygod/rsshub:latest" - ``` - - Depending on the actual situation, you may want to use other image tags, please read the relevant content of [Docker Image](#docker-image); -4. Modify the `[env]` section in fly.toml or use `fly secrets set KEY=VALUE` to [configure some modules](#configuration-route-specific-configurations); -5. Execute `fly deploy` to start the application; -6. (Optional) Use `fly certs add your domain` to configure a custom domain, and follow the instructions to configure the related domain resolution at your DNS service provider (you can check the domain configuration status on the Dashboard Certificate page). - -Upgrade: Enter the directory where you saved the `fly.toml` file and execute `fly deploy` to trigger the steps of pulling the latest image and starting the upgraded application. - -### Configure built-in Upstash Redis as cache - -Run in the `RSSHub` folder - -```bash -$ flyctl redis create -``` - -to create a new Redis database. Choose the same region as when you created the RSSHub app above, and it is recommended to enable [eviction](https://redis.io/docs/reference/eviction/). After creation, a string in the form of `redis://default:@.upstash.io` will be printed. - -Due to [a bug in a dependency](https://github.com/luin/ioredis/issues/1576), you currently need to append the `family=6` parameter to the URL provided by Fly.io, i.e., use `redis://default:@.upstash.io/?family=6` as the connection URL. - -Then configure the `[env]` section in fly.toml or run - -```bash -$ fly secrets set CACHE_TYPE=redis REDIS_URL='' -``` - -and execute `fly deploy` (if use the second install method) to trigger a redeployment to complete the configuration. - -## Deploy to PikaPods - -Run RSSHub from just $1/month. Includes automatic updates and $5 free starting credit. - -[![Run on PikaPods](https://www.pikapods.com/static/run-button.svg)](https://www.pikapods.com/pods?run=rsshub) - -## Deploy to Zeabur - -1. [Sign up for Zeabur](https://dash.zeabur.com) -2. Create a new project. -3. Create a new service in the project, select deploying from the **marketplace**. -4. Add a domain name, if you use a custom domain name, you can refer to [Zeabur's domain name binding document](https://docs.zeabur.com/deploy/domain-binding). - -[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://dash.zeabur.com/templates/X46PTP) - -## Deploy to Google App Engine(GAE) - -### Before You Begin - -Follow the [official guide](https://cloud.google.com/appengine/docs/flexible/nodejs/quickstart) for completing your GCP account settings, creating a new Node project, adding billing information (required), installing git and initializing gcloud([link](https://cloud.google.com/sdk/gcloud/)). Node.js is not required if you don't plan to debug RSSHub locally. - -Please note, GAE free tier doesn't support Flexible Environment, please check the pricing plan prior to deployment. - -Node.js standard environment is still under beta, unknown or unexpected errors might be encountered during the deployment. - -Execute `git clone https://github.com/DIYgod/RSSHub.git` to pull the latest code - -### app.yaml Settings - -#### Deploy to Flexible Environment - -Under RSSHub's root directory, create a file `app.yaml` with the following content: - -```yaml -# [START app_yaml] -runtime: custom -env: flex - -# This sample incurs costs to run on the App Engine flexible environment. -# The settings below are to reduce costs during testing and are not appropriate -# for production use. For more information, see: -# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml -manual_scaling: - instances: 1 -# app engine resources, adjust to suit your needs, the required disk space is 10 GB -resources: - cpu: 1 - memory_gb: 0.5 - disk_size_gb: 10 -network: - forwarded_ports: - - 80:1200 - - 443:1200 -# environment variables section, refer to Settings -env_variables: - CACHE_EXPIRE: '300' -# [END app_yaml] -``` - -#### Deploy to standard environment - -Under RSSHub's root directory, create a file `app.yaml` with the following content: - -```yaml -# [START app_yaml] -runtime: nodejs8 - -network: - forwarded_ports: - - 80:1200 - - 443:1200 -# environment variables section, refer to Settings -env_variables: - CACHE_EXPIRE: '300' -# [END app_yaml] -``` - -### Install - -Under RSSHub's root directory, execute the following commands to launch RSSHub - -```bash -gcloud app deploy -``` - -For changing the deployment project id or version id, please refer to `Deploying a service` section [here](https://cloud.google.com/appengine/docs/flexible/nodejs/testing-and-deploying-your-app). - -You can access your `Google App Engine URL` to check the deployment status - -## Play with Docker - -If you would like to test routes or avoid IP limits, etc., you may build your own RSSHub for free by clicking the button below. - -[![Try in PWD](https://raw.githubusercontent.com/play-with-docker/stacks/master/assets/images/button.png)](https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/DIYgod/RSSHub/master/docker-compose.yml) - -:::warning - -- [DockerHub](https://hub.docker.com) account required -- [Play with Docker](https://labs.play-with-docker.com/) instance will last for 4 hours at most. It should only be used for testing purpose -- If deploy success but port cannot be auto-deteced,please click the `open port` button on the top and type `1200` -- Sometimes PWD won't work as expected. If you encounter blank screen after `Start`, or some error during initialization, please retry - -::: diff --git a/website/docs/install/config.md b/website/docs/install/config.md deleted file mode 100644 index e97d1cf97..000000000 --- a/website/docs/install/config.md +++ /dev/null @@ -1,622 +0,0 @@ -# Configuration - -Configure RSSHub by setting environment variables - -## Network Configuration - -`PORT`: listening port, default to `1200` - -`SOCKET`: listening Unix Socket, default to `null` - -`LISTEN_INADDR_ANY`: open up for external access, default to `1` - -`REQUEST_RETRY`: retries allowed for failed requests, default to `2` - -`REQUEST_TIMEOUT`: milliseconds to wait for the server to end the response before aborting the request with error, default to `3000` - -`UA`: user agent, using random user agent (Chrome on macOS) by default - -`NO_RANDOM_UA`: disable random user agent, default to `null` - -## CORS Request - -RSSHub by default reject CORS requests. This behavior can be modified via setting `ALLOW_ORIGIN: *` or `ALLOW_ORIGIN: www.example.com`. - -## Cache Configurations - -RSSHub supports two caching methods: memory and redis - -`CACHE_TYPE`: cache type, `memory` or `redis`, empty this value will disable caching, default to `memory` - -`CACHE_EXPIRE`: route cache expiry time in seconds, default to `5 * 60` - -`CACHE_CONTENT_EXPIRE`: content cache expiry time in seconds, it will be recalculated when it is accessed, default to `1 * 60 * 60` - -`REDIS_URL`: Redis target address (invalid when `CACHE_TYPE` is set to memory), default to `redis://localhost:6379/` - -`MEMORY_MAX`: maximum number of cached items (invalid when `CACHE_TYPE` is set to redis), default to `256` - -## Proxy Configurations - -Partial routes have a strict anti-crawler policy, and can be configured to use proxy. - -Proxy can be configured through **Proxy URI**, **Proxy options**, **PAC script**, or **Reverse proxy**. - -### Proxy URI - -`PROXY_URI`: Proxy supports socks4, socks5(hostname is resolved locally, not recommanded), socks5h(hostname is -resolved by the SOCKS server, recommanded, prevents DNS poisoning or DNS leak), http, https. See [socks-proxy-agent](https://www.npmjs.com/package/socks-proxy-agent) NPM package page. See also [cURL OOTW: SOCKS5](https://daniel.haxx.se/blog/2020/05/26/curl-ootw-socks5/). - -> Proxy URI's format: -> -> - `{protocol}://{host}:{port}` -> - `{protocol}://{username}:{password}@{host}:{port}` (with credentials) -> -> Some examples: -> -> - `socks4://127.0.0.1:1080` -> - `socks5h://user:pass@127.0.0.1:1080` (username as `user`, password as `pass`) -> - `socks://127.0.0.1:1080` (`socks5h` when protocol is `socks`) -> - `http://127.0.0.1:8080` -> - `http://user:pass@127.0.0.1:8080` -> - `https://127.0.0.1:8443` - -### Reverse proxy - -:::warning - -This proxy method cannot proxy requests that contain cookies. - -::: - -`REVERSE_PROXY_URL`: Reverse proxy URL, RSSHub will use this URL as a prefix to initiate requests, for example `https://proxy.example.com?target=`, requests to `https://google.com` will be automatically converted to `https://proxy.example.com?target=https%3A%2F%2Fgoogle.com` - -You can use Cloudflare Workers to build a simple reverse proxy, for example: - -```js -addEventListener('fetch', event => { - event.respondWith(handleRequest(event.request)) -}) - -async function handleRequest(request) { - const url = new URL(request.url) - let target = url.searchParams.get('target') - - if (!target) { - return new Response('Hello, this is Cloudflare Proxy Service. To proxy your requests, please use the "target" URL parameter.') - } else { - target = decodeURIComponent(target) - const newRequest = new Request(target, { - headers: request.headers, - method: request.method, - body: request.body - }) - return await fetch(newRequest) - } -} -``` - -### PAC script - -:::warning - -This proxy method overwrites `PROXY_URI`, `PROXY_PROTOCOL`, `PROXY_HOST` and `PROXY_PORT`. - -::: - -About PAC script, please refer to [Proxy Auto-Configuration (PAC) file](https://developer.mozilla.org/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file). - -`PAC_URI`: PAC script URL, supports http, https, ftp, file, data. See [pac-proxy-agent](https://www.npmjs.com/package/pac-proxy-agent) NPM package page. - -`PAC_SCRIPT`: Hard-coded JavaScript code string of PAC script. Overwrites `PAC_URI`. - -### Proxy options - -`PROXY_PROTOCOL`: Using proxy, supports socks, http, https, etc. See [socks-proxy-agent](https://www.npmjs.com/package/socks-proxy-agent) NPM package page and [source](https://github.com/TooTallNate/proxy-agents/blob/63adbcefdb4783cc67c0eb90200886b4064e8639/packages/socks-proxy-agent/src/index.ts#L81) for what these protocols mean. See also [cURL OOTW: SOCKS5](https://daniel.haxx.se/blog/2020/05/26/curl-ootw-socks5/) for reference. - -`PROXY_HOST`: host or IP of the proxy - -`PROXY_PORT`: port of the proxy - -`PROXY_AUTH`: credentials to authenticate a user agent to proxy server, `Proxy-Authorization: Basic ${process.env.PROXY_AUTH}` - -`PROXY_URL_REGEX`: regex for url of enabling proxy, default to `.*` - -## Access Control Configurations - -RSSHub supports access control using access keys/codes. Enabling it will activate global access control, and lack of access permission will result in denied access. - -### Allowlisting/denylisting - -This configuration has been removed. It is recommended to use a proxy server such as Nginx or Cloudflare for access control. - -### Access Key/Code - -- `ACCESS_KEY`: the access key. When set, access via the key directly or the access code described above - -Access code is the md5 generated based on the access key + route, eg: - -| Access key | Route | Generating access code | Access code | -| ----------- | ----------------- | ---------------------------------------- | -------------------------------- | -| ILoveRSSHub | /qdaily/column/59 | md5('/qdaily/column/59' + 'ILoveRSSHub') | 0f820530128805ffc10351f22b5fd121 | - -- Routes are accessible via `code`, eg: `https://rsshub.app/qdaily/column/59?code=0f820530128805ffc10351f22b5fd121` - -- Or using `key` directly, eg: `https://rsshub.app/qdaily/column/59?key=ILoveRSSHub` - -## Logging Configurations - -`DEBUG_INFO`: display route information on the homepage for debugging purposes. When set to neither `true` nor `false`, use parameter `debug` to enable display, eg: `https://rsshub.app/?debug=value_of_DEBUG_INFO` . Default to `true` - -`LOGGER_LEVEL`: specifies the maximum [level](https://github.com/winstonjs/winston#logging-levels) of messages to the console and log file, default to `info` - -`NO_LOGFILES`: disable logging to log files, default to `false` - -`SHOW_LOGGER_TIMESTAMP`: Show timestamp in log, default to `false` - -`SENTRY`: [Sentry](https://sentry.io) dsn, used for error tracking - -`SENTRY_ROUTE_TIMEOUT`: Report Sentry if route execution takes more than this milliseconds, default to `3000` - -## Image Processing - -:::tip New Config Format - -We are currently testing out a new format, providing end-user with more flexibility. For more info, please refer to [Parameters->Multimedia processing](/parameter#multimedia-processing). - -When using our new config, please leave the following environment vairable blank. By default, image hotlink template will be forced when present. - -::: - -`HOTLINK_TEMPLATE`: replace image URL in the description to avoid anti-hotlink protection, leave it blank to disable this function. Usage reference [#2769](https://github.com/DIYgod/RSSHub/issues/2769). You may use any property listed in [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL#Properties) (suffixing with `_ue` results in URL encoding), format of JS template literal. e.g. `${protocol}//${host}${pathname}`, `https://i3.wp.com/${host}${pathname}`, `https://images.weserv.nl?url=${href_ue}` - -`HOTLINK_INCLUDE_PATHS`: limit the routes to be processed, only matched routes will be processed. Set multiple values with comma `,` as delimiter. If not set, all routes will be processed - -`HOTLINK_EXCLUDE_PATHS`: exclude routes that do not need to be processed, all matched routes will be ignored. Set multiple values with comma `,` as delimiter. Can be used alone, or to exclude routes that are already included by `HOTLINK_INCLUDE_PATHS`. If not set, no routes will be ignored - -:::tip Route matching pattern - -`HOTLINK_INCLUDE_PATHS` and `HOTLINK_EXCLUDE_PATHS` match the root path and all recursive sub-paths of the route, but not substrings. Note that the path must start with `/` and end without `/`. - -e.g. `/example`, `/example/sub` and `/example/anthoer/sub/route` will be matched by `/example`, but `/example_route` will not be matched. - -It is also valid to contain route parameters, e.g. `/weibo/user/2612249974`. - -::: - -## Features - -:::tip[Experimental features] - -Configs in this sections are in beta stage, and **are turn off by default**. Please read corresponded description and turn on if necessary. - -::: - -`ALLOW_USER_HOTLINK_TEMPLATE`: [Parameters->Multimedia processing](/parameter#multimedia-processing) - -`FILTER_REGEX_ENGINE`: Define Regex engine used in [Parameters->filtering](/parameter#filtering). Valid value are `[re2, regexp]`. Default value is `re2`. We suggest public instance should leave this value to default, and this option right now is mainly for backward compatibility. - -`ALLOW_USER_SUPPLY_UNSAFE_DOMAIN`: allow users to provide a domain as a parameter to routes that are not in their allow list, respectively. Public instances are suggested to leave this value default, as it may lead to [Server-Side Request Forgery (SSRF)](https://owasp.org/www-community/attacks/Server_Side_Request_Forgery) - -## Other Application Configurations - -`DISALLOW_ROBOT`: prevent indexing by search engine, default to enable, set false or 0 to disable - -`ENABLE_CLUSTER`: enable cluster mode, default to `false` - -`NODE_ENV`: display error message on pages for authentication failing, default to `production` (i.e. no display) - -`NODE_NAME`: node name, used for load balancing, identify the current node - -`PUPPETEER_WS_ENDPOINT`: browser WebSocket endpoint which can be used as an argument to puppeteer.connect, refer to [browserWSEndpoint](https://pptr.dev/api/puppeteer.browser.wsendpoint) - -`CHROMIUM_EXECUTABLE_PATH`: path to the Chromium (or Chrome) executable. If puppeteer is not bundled with Chromium (manually skipped downloading or system architecture is arm/arm64), configuring this can effectively enable puppeteer. Or alternatively, if you prefer Chrome to Chromium, this configuration will help. **WARNING**: only effective when `PUPPETEER_WS_ENDPOINT` is not set; only useful for manual deployment, for Docker, please use the `chromium-bundled` image instead. - -`TITLE_LENGTH_LIMIT`: limit the length of feed title generated in bytes, an English alphabet counts as 1 byte, the rest such as Chinese, Japanese, Korean or Arabic counts as 2 bytes by design, default to `150` - -`OPENAI_API_KEY`: OpenAI API Key, used for using ChatGPT to summarize articles - -`OPENAI_MODEL`: OpenAI model name, used for using ChatGPT to summarize articles, default to `gpt-3.5-turbo-16k`, see [OpenAI API reference](https://platform.openai.com/docs/models/overview) for details - -`OPENAI_TEMPERATURE`: OpenAI temperature parameter, used for using ChatGPT to summarize articles, default to `0.2`, see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/create#chat-create-temperature) for details - -`OPENAI_MAX_TOKENS`: OpenAI maximum token number, used for using ChatGPT to summarize articles, default to `null`, see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat/create#chat-create-max_tokens) for details - -`OPENAI_API_ENDPOINT`: OpenAI API URL, used for using ChatGPT to summarize articles, default to `https://api.openai.com/v1`, see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat) for details - -`OPENAI_PROMPT`: OpenAI prompt, used for using ChatGPT to summarize articles, see [OpenAI API reference](https://platform.openai.com/docs/api-reference/chat) for details - -`REMOTE_CONFIG`: Remote configuration URL, used for dynamically updating configurations. The address should return a JSON with an environment variable name as the key. It will be loaded and merged with local configurations when the application starts. In case of conflicts with local configurations, remote configurations will take precedence. But please note that some basic configuration items do not support remote retrieval. - -## Route-specific Configurations {#route-specific-configurations} - -:::tip - -Configs here are incomplete. - -See docs of the specified route and `lib/config.ts` for detailed information. - -::: - -### 4399 论坛 - -- `GAME_4399`: 对应登录后的 cookie 值,获取方式: - 1. 在 4399 首页登录。 - 2. 打开开发者工具,切换到 Network 面板,刷新 - 3. 查找`www.4399.com`的访问请求,点击请求,在右侧 Headers 中找到 Cookie. - -### bilibili - -- `BILIBILI_COOKIE_{uid}`: 用于用户关注动态系列路由,对应 uid 的 b 站用户登录后的 Cookie 值,`{uid}` 替换为 uid,如 `BILIBILI_COOKIE_2267573`,获取方式: - 1. 打开 [https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=0&type=8](https://api.vc.bilibili.com/dynamic_svr/v1/dynamic_svr/dynamic_new?uid=0&type=8) - 2. 打开控制台,切换到 Network 面板,刷新 - 3. 点击 dynamic_new 请求,找到 Cookie - 4. 视频和专栏,UP 主粉丝及关注只要求 `SESSDATA` 字段,动态需复制整段 Cookie -- `BILIBILI_DM_IMG_LIST`: 用于获取UP主投稿系列的路由,获取方式: - 1. 打开 [任意UP主个人空间页](https://space.bilibili.com/1) - 2. 打开控制台,切换到 Network 面板,关闭缓存,刷新,鼠标在窗口内不断移动 - 3. 使用过滤器找到符合 `https://api.bilibili.com/x/space/wbi/arc/search` 的请求 - 4. 复制请求参数中 `dm_img_list` 字段的内容,如 `[{"x":2721,"y":615,"z":0,"timestamp":29,"type":0}]` - -### Bitbucket - -[Basic auth with App passwords](https://developer.atlassian.com/cloud/bitbucket/rest/intro/#basic-auth) - -- `BITBUCKET_USERNAME`: Your Bitbucket username -- `BITBUCKET_PASSWORD`: Your Bitbucket app password - -### BTBYR - -- `BTBYR_HOST`: 支持 ipv4 访问的 BTBYR 镜像,默认为原站 `https://bt.byr.cn/`。 -- `BTBYR_COOKIE`: 注册用户登录后的 Cookie 值,获取方式: - 1. 登录后打开网站首页 - 2. 打开控制台,刷新 - 3. 找到 `https://bt.byr.cn/index.php` 请求 - 4. 找到请求头中的 Cookie - -### BUPT - -- `BUPT_PORTAL_COOKIE`: 登录后获得的 Cookie 值,获取方式 - 1. 打开 [https://webapp.bupt.edu.cn/wap/login.html?redirect=https://](https://webapp.bupt.edu.cn/wap/login.html?redirect=https://) 并登录 - 2. 无视掉报错,并打开 [https://webapp.bupt.edu.cn/extensions/wap/news/list.html?p-1&type=xnxw](https://webapp.bupt.edu.cn/extensions/wap/news/list.html?p-1&type=xnxw) - 3. 打开控制台,刷新 - 4. 找到 `https://webapp.bupt.edu.cn/extensions/wap/news/list.html?p-1&type=xnxw` 请求 - 5. 找到请求头中的 Cookie - -### Civitai - -- `CIVITAI_COOKIE`: Cookie of Civitai - -### Discord - -- `DISCORD_AUTHORIZATION`: Discord authorization token, can be found in the header of XHR requests after logging in Discord web client - -### Discourse - -- `DISCOURSE_CONFIG_{id}`: `id` could be arbitrary number or string, while the value should be the format of `{"link":link,"key":key}`, where: - - `link` is the link to the forum. - - `key` is the access key for the forum API, which you can refer to [this snippet](https://pastebin.com/YbLCgdWW) to obtain one. Ensure that this key is granted sufficient permission. - -### Discuz cookie - -- `DISCUZ_COOKIE_{cid}`: Cookie of a forum powered by Discuz, cid can be anything from 00 to 99. When visiting a Discuz route, use cid to specify this cookie. - -### Disqus - -[API Key application](https://disqus.com/api/applications/) - -- `DISQUS_API_KEY`: Disqus API - -### douban - -- `DOUBAN_COOKIE`: Cookie of douban user - -### E-Hentai - -- `EH_IPB_MEMBER_ID`: The value of `ipb_member_id` in the cookie header after logging in E-Hentai -- `EH_IPB_PASS_HASH`: The value of `ipb_pass_hash` in the cookie header after logging in E-Hentai -- `EH_SK`: The value of `sk` in the cookie header after logging in E-Hentai -- `EH_STAR`: The value of `star` in the cookie header if your account has stars. If this value is set, image limit allocation will links to the account rather than IP address -- `EH_IGNEOUS`: The value of `igneous` in the cookie header after logging in ExHentai. If this value is set, RSS will be generated from ExHentai -- `EH_IMG_PROXY`: Cover proxy address. If this is set, the link to the cover image will be replaced with this value at the beginning. When using ExHentai, the cover image requires cookies to access it, so you can use this with a cookie-added proxy server to access the cover image without cookies in some readers. - -### Fantia - -- `FANTIA_COOKIE`: The `cookie` after login can be obtained by viewing the request header in the console, If not filled in will cause some posts that require login to read to get exceptions - -### Gitee - -[申请地址](https://gitee.com/api/v5/swagger) - -- `GITEE_ACCESS_TOKEN`: Gitee 私人令牌 - -### GitHub - -[Access Token application](https://github.com/settings/tokens) - -- `GITHUB_ACCESS_TOKEN`: GitHub Access Token - -### Google Fonts - -[API key application](https://developers.google.com/fonts/docs/developer_api#a_quick_example) - -- `GOOGLE_FONTS_API_KEY`: API key - -### Instagram - -- `IG_USERNAME`: Your Instagram username (Private API only) -- `IG_PASSWORD`: Your Instagram password (Private API only) -- `IG_PROXY`: Proxy URL for Instagram (Private API only, optional) -- `IG_COOKIE`: Your Instagram cookie (Cookie only) - -Warning: Two Factor Authentication is **not** supported. - -### Iwara - -- `IWARA_USERNAME`: username of Iwara User -- `IWARA_PASSWORD`: password of Iwara User - -### Last.fm - -- `LASTFM_API_KEY`: Last.fm API Key - - -### LightNovel.us - -- `SECURITY_KEY`: security_key in the token,please remove %22,example `{%22security_key%22:%223cXXXX%22}`,only need 3cXXXX - -### Email - -- `EMAIL_CONFIG_{email}`: Mail setting, replace `{email}` with the email account, replace `@` and `.` in email account with `_`, e.g. `EMAIL_CONFIG_xxx_gmail_com`. The value is in the format of `password=password&host=server&port=port`, eg: - - Linux env: `EMAIL_CONFIG_xxx_qq_com="password=123456&host=imap.qq.com&port=993"` - - docker env: `EMAIL_CONFIG_xxx_qq_com=password=123456&host=imap.qq.com&port=993`, please do not include quotations `'`,`"` - -- Note: socks5h proxy is not supported due to the limit of email lib `ImapFlow` - -### Mastodon - -For user timeline - -Apply API at `https://mastodon.example/settings/applications` (replace `mastodon.example`). Scopes `read:search` and `read:statuses` are needed. - -- `MASTODON_API_HOST`: API instance domain, only domain, no `http://` or `https://` protocol header -- `MASTODON_API_ACCESS_TOKEN`: user access token -- `MASTODON_API_ACCT_DOMAIN`: acct domain for this instance, i.e. the `domain` in the WebFinger URI `username@domain`. It's usually the same as `MASTODON_API_HOST`. - -### Medium - -Open the console, copy the cookie (in theory, only uid and sid are required) - -- `MEDIUM_ARTICLE_COOKIE`: Cookie used when requesting the full article, can access the full text of paid content when there is an active Member subscription. -- `MEDIUM_COOKIE_{username}`: Cookie of the user corresponding to the username, required for personalized recommendation related routes. - -### MiniFlux - -- `MINIFLUX_INSTANCE`: The instance used by the user, by default, is the official MiniFlux [paid service address](https://reader.miniflux.app) -- `MINIFLUX_TOKEN`: User's API key, please log in to the instance used and go to `Settings` -> `API Key` -> `Create a new API key` to obtain. - -### Netease Cloud Music Playlists - -For playlists and song rankings - -- `NCM_COOKIES`: Cookies after logging into Netease Cloud Music, available via `document.cookie` in the browser console. - -### nhentai torrent - -[Registration](https://nhentai.net/register/) - -- `NHENTAI_USERNAME`: nhentai username or email -- `NHENTAI_PASSWORD`: nhentai password - -### Notion - -- `NOTION_TOKEN`: Notion Internal Integration Token, Refer to [Notion Official Set Up Flow](https://developers.notion.com/docs/authorization#internal-integration-auth-flow-set-up) to create Token - -### pianyuan - -[注册地址](https://pianyuan.org) - -- `PIANYUAN_COOKIE`: 对应 cookie 中的 `py_loginauth`, 例:PIANYUAN_COOKIE='py_loginauth=xxxxxxxxxx' - -### Pixabay - -[Documentation](https://pixabay.com/api/docs/) - -- `PIXABAY_KEY`: Pixabay API key - -### pixiv - -[Registration](https://accounts.pixiv.net/signup) - -- `PIXIV_REFRESHTOKEN`: Please refer to [this article](https://gist.github.com/ZipFile/c9ebedb224406f4f11845ab700124362) to get a `refresh_token` -- `PIXIV_BYPASS_CDN`: bypass Cloudflare bot check by directly accessing Pixiv source server, defaults to disable, set `true` or `1` to enable -- `PIXIV_BYPASS_HOSTNAME`: Pixiv source server hostname or IP address, hostname will be resolved to IPv4 address via `PIXIV_BYPASS_DOH`, defaults to `public-api.secure.pixiv.net` -- `PIXIV_BYPASS_DOH`: DNS over HTTPS endpoint, it must be compatible with Cloudflare or Google DoH JSON schema, defaults to `https://1.1.1.1/dns-query` -- `PIXIV_IMG_PROXY`: Used as a proxy for image addresses, as pixiv images have anti-theft, default to `https://i.pixiv.re` - -### pixiv fanbox - -Get paid content - -- `FANBOX_SESSION_ID`: equals to `FANBOXSESSID` in site cookies. - -### Saraba1st - -用于获取帖子里的图片 - -- `SARABA1ST_COOKIE`: 对应网页端的 Cookie。 - -### Sci-hub - -For scientific journal routes - -- `SCIHUB_HOST`: The Sci-hub mirror address that is accessible from your location, default to `https://sci-hub.se`. - -### Spotify - -[API key registration](https://developer.spotify.com) - -- `SPOTIFY_CLIENT_ID`: Client ID of the application -- `SPOTIFY_CLIENT_SECRET`: Client secret of the application - -For user data related routes - -- `SPOTIFY_REFRESHTOKEN`: The refresh token of the user from the Spotify application. You can obtain it through [spotify-refresh-token](https://alecchen.dev/spotify-refresh-token/) by [alecchendev](https://github.com/alecchendev/spotify-refresh-token). - -:::tip - -Remember to check `user-top-read` and `user-library-read` in the scope for `Personal Top Items` and `Personal Saved Tracks` respectively. - -::: - -### Telegram - -[Bot application](https://telegram.org/blog/bot-revolution) - -- `TELEGRAM_TOKEN`: Telegram bot token for stickerpack feeds -- `TELEGRAM_SESSION`: for video and file streaming, can be acquired by running `node lib/routes/telegram/tglib/client.js` - -### Twitter - -It is recommended to use a non-important account, new accounts or logins from different regions may be restricted. - -- `TWITTER_USERNAME`: Twitter username -- `TWITTER_PASSWORD`: Twitter password -- `TWITTER_AUTHENTICATION_SECRET`: Optional, Twitter Two-factor authentication -> Authentication app -> Secret part in `otpauth://totp/Twitter:@_RSSHub?secret=xxxxxxxxxxxxxxxx&issuer=Twitter` - -### Wordpress - -- `WORDPRESS_CDN`: Proxy HTTP image link with HTTPS link. Consider using: - - | url | backbone | - | -------------------------------------- | ------------ | - | [https://imageproxy.pimg.tw/resize?url=](https://imageproxy.pimg.tw/resize?url=) | akamai | - | [https://images.weserv.nl/?url=](https://images.weserv.nl/?url=) | cloudflare | - | [https://pic1.xuehuaimg.com/proxy](https://pic1.xuehuaimg.com/proxy) | cloudflare | - | [https://cors.netnr.workers.dev](https://cors.netnr.workers.dev) | cloudflare | - | [https://netnr-proxy.openode.io](https://netnr-proxy.openode.io) | digitalocean | - -### YouTube - -[API Key application](https://console.developers.google.com/) - -- All routes: - - `YOUTUBE_KEY`: YouTube API Key, support multiple keys, split them with `,` -- Extra requirements for subscriptions route: - - `YOUTUBE_CLIENT_ID`: YouTube API OAuth 2.0 client ID - - `YOUTUBE_CLIENT_SECRET`: YouTube API OAuth 2.0 client secret - - `YOUTUBE_REFRESH_TOKEN`: YouTube API OAuth 2.0 refresh token. Check [this gist](https://gist.github.com/Kurukshetran/5904e8cb2361623498481f4a9a1338aa) for detailed instructions. - -### ZodGame - -- `ZODGAME_COOKIE`: Cookie of ZodGame User - -### 北京大学 - -用于北大未名 BBS 全站十大 - -- `PKUBBS_COOKIE`: BBS 注册用户登录后的 Cookie 值,获取方式: - 1. 登录后打开论坛首页 - 2. 打开控制台, 刷新 - 3. 找到 `https://bbs.pku.edu.cn/v2/home.php` 请求 - 4. 找到请求头中的 Cookie - -### 滴答清单 - -- `DIDA365_USERNAME`: 滴答清单用户名 -- `DIDA365_PASSWORD`: 滴答清单密码 - -### 端传媒 - -用于获取付费内容全文 - -- `INITIUM_BEARER_TOKEN`: 端传媒 Web 版认证 token。获取方式:登陆后打开端传媒站内任意页面,打开浏览器开发者工具中 “网络”(Network) 选项卡,筛选 URL 找到任一个地址为`api.initium.com`开头的请求,点击检查其 “消息头”,在 “请求头” 中找到`Authorization`字段,将其值复制填入配置即可。你的配置应该形如`INITIUM_BEARER_TOKEN: 'Bearer eyJxxxx......xx_U8'`。使用 token 部署的好处是避免占据登陆设备数的额度,但这个 token 一般有效期为两周,因此只可作临时测试使用。 - -- `INITIUM_IAP_RECEIPT`: 端传媒 iOS 版内购回执认证 token。获取方式:登陆后打开端传媒 iOS app 内任意页面,打开抓包工具,筛选 URL 找到任一个地址为`api.initium.com`开头的请求,点击检查其 “消息头”,在 “请求头” 中找到`X-IAP-Receipt`字段,将其值复制填入配置即可。你的配置应该形如`INITIUM_IAP_RECEIPT: 'ef81dee9e4e2fe084a0af1ea82da2f7b16e75f756db321618a119fa62b52550e'`。 - -Web 版认证 token 和 iOS 内购回执认证 token 只需选择其一填入即可。你也可选择直接在环境设置中填写明文的用户名和密码: - -- `INITIUM_USERNAME`: 端传媒用户名 (邮箱) -- `INITIUM_PASSWORD`: 端传媒密码 - -### 豆瓣 - -用于想看 - -- `DOUBAN_COOKIE`: 豆瓣登陆后的 Cookie 值 - -### 饭否 - -[申请地址](https://github.com/FanfouAPI/FanFouAPIDoc/wiki/Oauth) - -- `FANFOU_CONSUMER_KEY`: 饭否 Consumer Key -- `FANFOU_CONSUMER_SECRET`: 饭否 Consumer Secret -- `FANFOU_USERNAME`: 饭否登录用户名、邮箱、手机号 -- `FANFOU_PASSWORD`: 饭否密码 - -### 和风天气 - -[申请地址](https://id.qweather.com/#/register?redirect=https%3A%2F%2Fconsole.qweather.com) - -- `HEFENG_KEY`:API key - -### 米游社 - -- `MIHOYO_COOKIE`:登录米游社后的 cookie,用于获取用户关注动态时间线。 - -### 南方周末 - -用于付费全文 - -- `INFZM_COOKIE`: infzm 账户登陆后的 cookie,目前只需要 `passport_session=...` 即可获取全文 - -### 轻小说文库 - -- `WENKU8_COOKIE`: 登陆轻小说文库后的 cookie - -### 色花堂 - -- `SEHUATANG_COOKIE`: 登陆色花堂后的 cookie 值。 - -### 微博 - -用于个人时间线路由 - -[申请地址](https://open.weibo.com/connect) - -- `WEIBO_APP_KEY`: 微博 App Key -- `WEIBO_APP_SECRET`: 微博 App Secret -- `WEIBO_REDIRECT_URL`: 微博登录授权回调地址,默认为 `RSSHub 地址/weibo/timeline/0`,自定义回调地址请确保最后可以转跳到 `RSSHub 地址/weibo/timeline/0?code=xxx` - -用于自定义分组 - -- `WEIBO_COOKIES`: 用户访问网页微博时所使用的 cookie, 获取方式: - 1. 打开并登录 [https://m.weibo.cn](https://m.weibo.cn) (确保打开页面为手机版,如果强制跳转电脑端可尝试使用可更改 UserAgent 的浏览器插件) - 2. 按下`F12`打开控制台,切换至`Network(网络)`面板 - 3. 在该网页切换至任意关注分组,并在面板打开最先捕获到的请求 (该情形下捕获到的请求路径应包含`/feed/group`) - 4. 查看该请求的`Headers(请求头)`, 找到`Cookie`字段并复制内容 - -### 小宇宙 - -需要 App 登陆后抓包获取相应数据。 - -- `XIAOYUZHOU_ID`: 即数据包中的 `x-jike-device-id`。 -- `XIAOYUZHOU_TOKEN`: 即数据包中的 `x-jike-refresh-token`。 - -### 新榜 - -- `NEWRANK_COOKIE`: 登陆后的 COOKIE 值,其中 token 是必要的,其他可删除 - -### 喜马拉雅 - -- `XIMALAYA_TOKEN`: 对应 cookie 中的 `1&_token`,获取方式: - 1. 登陆喜马拉雅网页版 - 2. 打开控制台,刷新 - 3. 查找名称为`1&_token`的`cookie`,其内容即为`XIMALAYA_TOKEN`的值(即在`cookie` 中查找 `1&_token=***;`,并设置 `XIMALAYA_TOKEN = ***`) - -### 知乎 - -用于用户关注时间线 - -- `ZHIHU_COOKIES`: 知乎登录后的 cookie 值。 - 1. 可以在知乎网页版的一些请求的请求头中找到,如 `GET /moments` 请求头中的 `cookie` 值。 diff --git a/website/docs/instances.mdx b/website/docs/instances.mdx deleted file mode 100644 index f98fa6904..000000000 --- a/website/docs/instances.mdx +++ /dev/null @@ -1,15 +0,0 @@ -# Public Instances - -Although the official instances are already stable enough, in order to achieve decentralization, we encourage users to host their own RSSHub instances or use other public RSSHub instances. - -If you are willing to contribute your own instance for others to use, please edit [this file](https://github.com/DIYgod/RSSHub/tree/master/website/src/components/InstanceList.tsx) and submit a PR to add your instance to the list. - -## Official - -| URL | Location | Maintainer | Online | -| --- | --- | --- | --- | -| [rsshub.app](https://rsshub.app) | 🇺🇸 | [DIYgod](https://diygod.cc) | ![](https://img.shields.io/website.svg?label=&url=https://rsshub.app/test/cache) | - -## Public - - diff --git a/website/docs/joinus/advanced/_category_.json b/website/docs/joinus/advanced/_category_.json deleted file mode 100644 index 9ce123ad0..000000000 --- a/website/docs/joinus/advanced/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "Advanced", - "position": 4, - "collapsed": false -} diff --git a/website/docs/joinus/advanced/advanced-feed.md b/website/docs/joinus/advanced/advanced-feed.md deleted file mode 100644 index 449f7fd40..000000000 --- a/website/docs/joinus/advanced/advanced-feed.md +++ /dev/null @@ -1,211 +0,0 @@ ---- -sidebar_position: 1 ---- - -# RSS Feed Fundamentals - -This guide is intended for advanced users who want to know how to create an RSS feed in detail. If you're new to creating RSS feeds, we recommend reading [Create Your Own RSSHub Route](/joinus/new-rss/start-code) first. - -Once you have collected the data you want to include in your RSS feed, you can pass it to `ctx.set('data', obj)`. RSSHub's middleware [`template.ts`](https://github.com/DIYgod/RSSHub/blob/master/lib/middleware/template.ts) will then process the data and render the RSS output in the required format (which is RSS 2.0 by default). In addition to the fields mentioned in [Create your own RSSHub route](/joinus/new-rss/start-code), you can customize your RSS feed further using the following fields. - -It's important to note that not all fields are applicable to all output formats since RSSHub supports multiple output formats. The table below shows which fields are compatible with different output formats. We use the following symbols to denote compatibility: `A` for Atom, `J` for JSON Feed, `R` for RSS 2.0. - -Channel level - -The following table lists the fields you can use to customize your RSS feed at channel level: - -| Field | Description | Default | Compatibility | -| :---------- | :---------- | :----------- | :------------ | -| **`title`** | *(Recommended)* The name of the feed, which should be plain text only | `RSSHub` | A, J, R | -| **`link`** | *(Recommended)* The URL of the website associated with the feed, which should link to a human-readable website | `https://rsshub.app` | A, J, R | -| **`description`** | *(Optional)* The summary of the feed, which should be plain text only | If not specified, defaults to **`title`** | J, R | -| **`language`** | *(Optional)* The primary language of the feed, which should be a value from [RSS Language Codes](https://www.rssboard.org/rss-language-codes) or ISO 639 language codes | `zh-cn` | J, R | -| **`image`** | *(Recommended)* The URL of the image that represents the channel, which should be relatively large and square | `undefinded` | J, R | -| **`icon`** | *(Optional)* The icon of an Atom feed | `undefinded` | J | -| **`logo`** | *(Optional)* The logo of an RSS feed | `undefinded` | J | -| **`subtitle`** | *(Optional)* The subtitle of an Atom feed | `undefinded` | A | -| **`author`** | *(Optional)* The author of an Atom feed or the authors of a JSON feed | `RSSHub` | A, J | -| **`itunes_author`** | *(Optional)* The author of a podcast feed | `undefinded` | R | -| **`itunes_category`** | *(Optional)* The category of a podcast feed | `undefinded` | R | -| **`itunes_explicit`** | *(Optional)* Use this to indicate that a feed contains [explicit](https://help.apple.com/itc/podcasts_connect/#/itcfafb6d665) content. | `undefinded` | R | -| **`allowEmpty`** | *(Optional)* Whether to allow empty feeds. If set to `true`, the feed will be generated even if there are no items | `undefinded` | A, J, R | - -Each item in an RSS feed is represented by an object with a set of fields that describe it. The table below lists the available fields: - -| Field | Description | Default | Compatibility | -| :---------- | :---------- | :------------- | :------------ | -| **`title`** | *(Required)* The title of the item, which should be plain text only | `undefinded` | A, J, R | -| **`link`** | *(Recommended)* The URL of the item, which should link to a human-readable website | `undefinded` | A, J, R | -| **`description`** | *(Recommended)* The content of the item. For an Atom feed, it's the `atom:content` element. For a JSON feed, it's the `content_html` field | `undefinded` | A, J, R | -| **`author`** | *(Optional)* The author of the item | `undefinded` | A, J, R | -| **`category`** | *(Optional)* The category of the item. You can use a plain string or an array of strings | `undefinded` | A, J, R | -| **`guid`** | *(Optional)* The unique identifier of the item | **`link || title`** | A, J, R | -| **`pubDate`** | *(Recommended)* The publication date of the item, which should be a [Date object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) following [the standard](/joinus/advanced/pub-date) | `undefinded` | A, J, R | -| **`updated`** | *(Optional)* The date of the last modification of the item, which should be a [Date object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) | `undefinded` | A, J | -| **`itunes_item_image`** | *(Optional)* The URL of an image associated with the item | `undefinded` | R | -| **`itunes_duration`** | *(Optional)* The length of an audio or video item in seconds (or in the format H:mm:ss), which should be a number or string | `undefinded` | J, R | -| **`enclosure_url`** | *(Optional)* The URL of an enclosure associated with the item | `undefinded` | J, R | -| **`enclosure_length`** | *(Optional)* The size of the enclosure file in **byte**, which should be a number | `undefinded` | J, R | -| **`enclosure_type`** | *(Optional)* The MIME type of the enclosure file, which should be a string | `undefinded` | J, R | -| **`upvotes`** | *(Optional)* The number of upvotes the item has received, which should be a number | `undefinded` | A | -| **`downvotes`** | *(Optional)* The number of downvotes the item has received, which should be a number | `undefinded` | A | -| **`comments`** | *(Optional)* The number of comments for the item, which should be a number | `undefinded` | A | -| **`media.*`** | *(Optional)* The media associated with the item. See [Media RSS](https://www.rssboard.org/media-rss) for more details | `undefinded` | R | -| **`doi`** | *(Optional)* The Digital Object Identifier of the item, which should be a string in the format `10.xxxx/xxxxx.xxxx` | `undefinded` | R | - -:::warning Formatting Considerations - -When specifying certain fields in an RSS feed, it's important to keep in mind some formatting considerations. Specifically, you should avoid including any linebreaks, consecutive whitespace, or leading/trailing whitespace in the following fields: **`title`**, **`subtitle`** (only for Atom), **`author`** (only for Atom), **`item.title`**, and **`item.author`**. - -While most RSS readers will automatically trim these fields, some may not process them properly. Therefore, to ensure compatibility with all RSS readers, we recommend trimming these fields before outputting them. If your route cannot tolerate trimming these fields, you should consider changing their format. - -Additionally, while other fields will not be forced to be trimmed, we suggest avoiding violations of the above formatting rules as much as possible. If you are using Cheerio to extract content from web pages, be aware that Cheerio will retain line breaks and indentation. For the **`item.description`** field, in particular, any intended linebreaks should be converted to `
` tags to prevent them from being trimmed by the RSS reader. If you're extracting an RSS feed from JSON data, be aware that the JSON may contain linebreaks that need to be displayed, so you should convert them to `
` tags in this case. - -It's important to keep these formatting considerations in mind to ensure your RSS feed is compatible with all RSS readers. - -::: - -## Create a BitTorrent/Magnet Feed - -RSSHub allows you to create BitTorrent/Magnet feeds, which can be useful for triggering automated downloads. To create a BitTorrent/Magnet feed, you'll need to add **additional** fields to your RSS feed that are in accordance with many downloaders' subscription formats. - -Here's an example of how to create a BitTorrent/Magnet feed: - -```js -ctx.set('data', { - item: [ - { - enclosure_url: '', // This should be the Magnet URI - enclosure_length: '', // The file size in bytes (this field is optional) - enclosure_type: 'application/x-bittorrent', // This field should be fixed to 'application/x-bittorrent' - }, - ], -}); -``` - -By including these fields in your RSS feed, you'll be able to create BitTorrent/Magnet feeds that can be automatically downloaded by compatible downloaders. - -### Update the documentation - -If you're adding support for BitTorrent/Magnet feeds in your RSSHub route, it's important to update the documentation to reflect this change. To do this, you'll need to set the `supportBT` attribute of the `Route` component to `"1"`. Here's an example: - -```tsx - -``` - -By setting the `supportBT` attribute to `"1"`, you'll be able to update your documentation to accurately reflect your route's support for BitTorrent/Magnet feeds. - -## Create a Journal Feed - -RSSHub supports creating journal feeds that can replace `item.link` with a Sci-hub link if users provide the [common parameter](/parameter#sci-hub-link) `scihub`. To create a journal feed, you'll need to include an **additional** field in your RSS feed: - -```js -ctx.set('data', { - item: [ - { - doi: '', // This should be the DOI of the item (e.g., '10.47366/sabia.v5n1a3') - }, - ], -}); -``` - -By including this `doi` field in your RSS feed, you'll be able to create journal feeds that are compatible with RSSHub's Sci-hub functionality. - -### Update the documentation - -To update the documentation for your route with support for Sci-hub, you'll need to set the `supportScihub` attribute of the Route component to `"1"`. Here's an example: - -```tsx - -``` - -By setting the `supportSciHub` attribute to `"1"`, the documentation for your route will accurately reflect its support for creating journal feeds with Sci-hub links. - -## Create a Podcast Feed - -RSSHub supports creating podcast feeds that can be used with many podcast players' subscription formats. To create a podcast feed, you'll need to include several **additional** fields in your RSS feed: - -```js -ctx.set('data', { - itunes_author: '', // This field is **required** and should specify the podcast author's name - itunes_category: '', // This field specifies the channel category - image: '', // This field specifies the channel's cover image or album art - item: [ - { - itunes_item_image: '', // This field specifies the item's cover image - itunes_duration: '', // This field is optional and specifies the length of the audio in seconds or the format H:mm:ss - enclosure_url: '', // This should be the item's direct audio link - enclosure_length: '', // This field is optional and specifies the size of the file in **bytes** - enclosure_type: '', // This field specifies the MIME type of the audio file (common types are 'audio/mpeg' for .mp3, 'audio/x-m4a' for .m4a, and 'video/mp4' for .mp4) - }, - ], -}); -``` - -By including these fields in your RSS feed, you'll be able to create podcast feeds that are compatible with many podcast players. - -:::tip Further Reading - -- [A Podcaster’s Guide to RSS](https://help.apple.com/itc/podcasts_connect/#/itcb54353390) -- [RSS feed guidelines for Google Podcasts](https://support.google.com/podcast-publishers/answer/9889544) - -::: - -### Update the documentation - -To update the documentation for your route with support for podcast feeds, you'll need to set the `supportPodcast` attribute of the `Route` component to `"1"`. Here's an example: - -```tsx - -``` - -By setting the `supportPodcast` attribute to `"1"`, the documentation for your route will accurately reflect its support for creating podcast feeds. - -## Create a Media Feed - -RSSHub supports creating [Media RSS](https://www.rssboard.org/media-rss) feeds that are compatible with many [Media RSS](https://www.rssboard.org/media-rss) software subscription formats. To create a [Media RSS](https://www.rssboard.org/media-rss) feed, you'll need to include those **additional** fields in your RSS feed. - -Here's an example of how to create a [Media RSS](https://www.rssboard.org/media-rss) feed: - -```js -ctx.set('data', { - item: [ - { - media: { - content: { - url: '...', // This should be the URL of the media content - type: '...', // This should be the MIME type of the media content (e.g., 'audio/mpeg' for an .mp3 file) - }, - thumbnail: { - url: '...', // This should be the URL of the thumbnail image - }, - '...': { - '...': '...', // Additional media properties can be included here - } - }, - }, - ], -}); -``` - -By including these fields in your RSS feed, you'll be able to create [Media RSS](https://www.rssboard.org/media-rss) feeds that are compatible with many [Media RSS](https://www.rssboard.org/media-rss) software subscription formats. - -## Create an Atom Feed with Interactions - -RSSHub supports creating Atom feeds that include interactions like upvotes, downvotes, and comments. To create an Atom feed with interactions, you'll need to include **additional** fields in your RSS feed that specify the interaction counts for each item. - -Here's an example of how to create an Atom feed with interactions: - -```js -ctx.set('data', { - item: [ - { - upvotes: 0, // This should be the number of upvotes for this item - downvotes: 0, // This should be the number of downvotes for this item - comments: 0, // This should be the number of comments for this item - }, - ], -}); -``` - -By including these fields in your Atom feed, you'll be able to create Atom feeds with interactions that are compatible with many Atom feed readers. diff --git a/website/docs/joinus/advanced/debug.md b/website/docs/joinus/advanced/debug.md deleted file mode 100644 index 038fe883b..000000000 --- a/website/docs/joinus/advanced/debug.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -sidebar_position: 5 ---- - -# Debugging - -When debugging your code, you can use more than just `console.log` or attaching the node process to a debugger. You can also use the following methods for debugging. - -Note: The following methods are only effective when the instance is running with `debugInfo=true`. - -## Using `ctx.set('json', obj)` - -To pass a custom object to `ctx.set('json', obj)` for debugging, follow these steps: - -1. Create your custom object. -2. Pass your object to `ctx.set('json', obj)`. -3. Access the corresponding route with query string `format=debug.json` to view your object. For example, if you want to debug the route `/furstar/characters/:lang?`, you can access the URL: `/furstar/characters/en?format=debug.json` - -Here's an example of how to use `ctx.set('json', obj)` taken from [furstar/index.ts](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/furstar/index.ts) - -```js -const info = utils.fetchAllCharacters(res.data, base); - -ctx.set('json', { - info, -}); -``` - -In the example above, we're passing the `info` object to `ctx.set('json', obj)`, which we can then access using the corresponding route with query string `format=debug.json`. - -## debug.html - -In order to quickly test if the `description` in `ctx.set('data', obj)` is correct, you can use the query string `format={index}.debug.html` to obtain the HTML of the corresponding entry. The link can be directly opened in the browser to preview the rendering result. - -Usage: Access the corresponding route with query string `format={index}.debug.html`, where `{index}` is the item number (starting from 0) in your `data.item`. And the data corresponds to the `data.item[index].description` information will be returned as route result. diff --git a/website/docs/joinus/advanced/pub-date.md b/website/docs/joinus/advanced/pub-date.md deleted file mode 100644 index d0f919612..000000000 --- a/website/docs/joinus/advanced/pub-date.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -sidebar_position: 4 ---- - -# Date Handling - -When you visit a website, the website usually provides you with a date or timestamp. This tutorial will show you how to properly handle them in your code. - -## The Standard - -### No Date - -- **Do not** add a date when a website does not provide one. Leave the `pubDate` field undefined. -- Parse only the date and **do not add a time** to the `pubDate` field when a website provides a date but not an accurate time. - -The `pubDate` field must be a: - -1. [Date Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) -2. **Not recommended. Only use for compatibility**: Strings that can be parsed correctly because their behavior can be inconsistent across deployment environments. Use `Date.parse()` with caution. - -The `pubDate` passed from the route script should correspond to the time zone/time used by the server. For more details, see the following: - -## Use utilities class - -We recommend using [day.js](https://github.com/iamkun/dayjs) for date processing and time zone adjustment. There are two related utility classes: - -### Date and Time - -The RSSHub utility class includes a wrapper for [day.js](https://github.com/iamkun/dayjs) that allows you to easily parse date strings and obtain a [Date Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date) in most cases. - -```js -import { parseDate } from '@/utils/parse-date'; - -const pubDate = parseDate('2020/12/30'); -// OR -const pubDate = parseDate('2020/12/30', 'YYYY/MM/DD'); -``` - -:::tip - -You can refer to the [day.js documentation](https://day.js.org/docs/en/parse/string-format#list-of-all-available-parsing-tokens) for all available date formats. - -::: - -If you need to parse a relative date, use `parseRelativeDate`. - -```js -import { parseRelativeDate } from '@/utils/parse-date'; - -const pubDate = parseRelativeDate('2 days ago'); -const pubDate = parseRelativeDate('day before yesterday 15:36'); -``` - -### Timezone - -When parsing dates from websites, it's important to consider time zones. Some websites may not convert the time zone according to the visitor's location, resulting in a date that doesn't accurately reflect the user's local time. To avoid this issue, you can manually specify the time zone. - -To manually specify the time zone in your code, use the following code: - -```js -import timezone from '@/utils/timezone'; - -const pubDate = timezone(parseDate('2020/12/30 13:00'), +1); -``` - -The timezone function takes two parameters: the first is the original [Date Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date), and the second is the time zone offset. The offset is specified in hours, so in this example, a time zone of UTC+1 is used. - -By doing this, the time will be converted to server time and it will facilitate middleware processing. diff --git a/website/docs/joinus/advanced/script-standard.md b/website/docs/joinus/advanced/script-standard.md deleted file mode 100644 index b4c66ae0a..000000000 --- a/website/docs/joinus/advanced/script-standard.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Script Standard - -## Code Style - -### General Guidelines - -- **Be consistent!** -- Avoid using deprecated features. -- Avoid modifying `yarn.lock` and `package.json`, unless you are adding a new dependency. -- Conbine repetitive code into functions. -- Prefer higher ECMAScript Standard features over lower ones. -- Sort the entries alphabetically (uppercase first) to make it easier to find an entry. -- Use HTTPS instead of HTTP whenever possible. -- Use WebP format instead of JPG whenever possible since it offers better compression. - -### Formatting - -#### Indentation - -- Use 4 spaces for indentation for consistent and easy-to-read code. - -#### Semicolons - -- Add a semicolon at the end of each statement for improved readability and consistency. - -#### String - -- Use single quotes instead of double quotes whenever possible for consistency and readability. -- Use [template literals](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Template_literals) over complex string concatenation. -- Use [template literals](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Template_literals) for GraphQL queries as they make the code more concise and easy to read. - -#### Whitespace - -- Add an empty line at the end of each file. -- Avoid trailing whitespace for a clean and readable codebase. - -### Language Features - -#### Casting - -- Avoid re-casting the same type. - -#### Functions - -- Prefer [arrow functions](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Functions/Arrow_functions) over the `function` keyword. - -#### Loops - -- Use `for-of` instead of `for` for arrays ([javascript:S4138](https://rules.sonarsource.com/javascript/RSPEC-4138)). - -#### Variables - -- Use `const` and `let` instead of `var`. -- Declare one variable per declaration. - -### Naming - -- Use `lowerCamelCase` for variables and functions to adhere to standard naming conventions. -- Use `kebab-case` for files and folders. -- Use `CONSTANT_CASE` for constants. - -## Route Standard - -When creating a new route in RSSHub, you need to organize your files in a specific way. Your namespace folder should be stored in the `lib/routes` directory and should include three mandatory files: - -- `router.ts` Registers the routes -- `maintainer.ts` Provides information about the route maintainer -- `radar.ts` Provide a [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) rule for each route - -Your namespace folder structure should look like this: - -``` -├───lib/routes -│ ├───furstar -│ ├─── templates -│ ├─── description.art -│ ├─── router.ts -│ ├─── maintainer.ts -│ ├─── radar.ts -│ ├─── someOtherJs.ts -│ └───test -│ └───someOtherNamespaces -... -``` - -**All eligible routes under the `lib/routes` path will be automatically loaded without the need for updating the `lib/router.ts`.** - -### Namespace - -RSSHub appends the name of all route namespace folders in front of the actual route. Route maintainers should think of the namespace as the root. - -#### Naming Standard - -- Use the second-level domain (SLD) as your namespace. You can find more information about URL structure [here](/joinus/new-radar#top-level-object-key). -- Do not create variations of the same namespace. For more information, see [this page](/joinus/new-rss/before-start#create-a-namespace) - -### Registering a Route - -To register a route, the `router.ts` file should export a method that provides a Hoho route handler. - -### Maintainer List - -The `maintainer.ts` file should export an object that provides maintainer information related to the route, including: - -- Key: Corresponding route path -- Value: Array of string, including all maintainers' GitHub ID. - -To generate a list of maintainers, use the following command: `pnpm run build`, which will create the list under `assets/build/`. - -:::danger - -The path should be the same as the `path` in the corresponding documentation before the namespace appended in front of it. - -::: - -### Radar Rules - -All routes are required to include the `radar.ts` file, which includes the corresponding domain name. The minimum requirement for a successful match is for the rule to show up on the corresponding site which requires filling in the `title` and `docs` fields. - -To generate a complete `radar-rules.ts` file, use the following command: `yarn build`, which will create the file under `assets/build/`. - -:::tip - -Remember to remove all build artifacts in `assets/build/` before committing. - -::: - -### Rendering Templates - -When rendering custom content with HTML, such as `item.description`, using [art-template](https://aui.github.io/art-template/) for layout is mandatory. - -All templates should be placed in the namespace's `templates` folder with the `.art` file extension. - -#### Example - -Here's an example taken from the [furstar](https://github.com/DIYgod/RSSHub/blob/master/lib/routes/furstar) namespace: - -```html -
- - {{ if link !== null }} - {{name}} - {{ else }} - {{name}} - {{ /if }} -
-``` - -```js -import * as path from 'node:path'; -import { art } from '@/utils/render'; -const renderAuthor = (author) => art(path.join(__dirname, 'templates/author.art'), author); -``` - -### v1 Route Standard - -:::danger - -The v1 Route Standard is deprecated. All new routes should be following the [Route Standard](/joinus/advanced/script-standard#route-standard). - -::: diff --git a/website/docs/joinus/advanced/use-cache.md b/website/docs/joinus/advanced/use-cache.md deleted file mode 100644 index 8ffc5cdf2..000000000 --- a/website/docs/joinus/advanced/use-cache.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Using Cache - -RSSHub have a cache module that expires after a short duration. You can change how long the cache lasts by modifying the `CACHE_EXPIRE` value in the `lib/config.ts` file using environment variables. However, for interfaces that have less frequently updated content, it's better to specify a longer cache expiration time using `CACHE_CONTENT_EXPIRE` instead. - -For example, to retrieve the full text of the first comment for each issue, you can make a request to `${baseUrl}/${user}/${repo}/issues/${id}`, since this data is unavailable through `${baseUrl}/${user}/${repo}/issues`. It's recommended to store this data in the cache to avoid making repeated requests to the server. - -Here's an example of how you can use the cache to retrieve the data: - -```js - import cache from '@/utils/cache'; - - const items = await Promise.all( - list.map((item) => - cache.tryGet(item.link, async () => { - const { data: response } = await got(item.link); - const $ = load(response); - - item.description = $('.comment-body').first().html(); - - return item; - }) - ) - ); -``` - -The above code snippet from [Create Your Own RSSHub Route](/joinus/new-rss/start-code#better-reading-experience) shows how to use the cache to get the full text of the first comment of each issue. `cache.tryGet()` is used to determine if the data is already available within the cache. If it's not, the code retrieves the data and stores it in the cache. - -The object returned from the previous statement will be reused, and an extra `description` property will be added to it. The returned cache for each `item.link` will be `{ title, link, pubDate, author, category, description }`. The next time the same path is requested, this processed cache will be used instead of making a request to the server and recomputing the data. - -:::warning - -Any assignments to variables that are declared outside of the `tryGet()` function will not be processed under a cache-hit scenario. For example, the following code will not work as expected: - -```js - let x = '1'; - const z = await cache.tryGet('cache:key', async () => { - x = '2'; - const y = '3'; - return y; - }) - console.log(x); // cache miss: '2', cache hit: '1' - console.log(z): // '3' -``` - -::: - -## API - -### cache.tryGet(key, getValueFunc [, maxAge [, refresh ]]) - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| key | `string` | *(Required)* The key used to store and retrieve the cache. You can use `:` as a separator to create a hierarchy. | -| getValueFunc | `function` \| `string` | *(Required)* A function that returns data to be cached when a cache miss occurs. -| maxAge | `number` | *(Optional)* The maximum age of the cache in seconds. If not specified, `CACHE_CONTENT_EXPIRE` will be used. | -| refresh | `boolean` | *(Optional)* Whether to renew the cache expiration time when the cache is hit. `true` by default. | - -#### Defined in - -[lib/middleware/cache/index.ts](https://github.com/DIYgod/RSSHub/blob/master/lib/middleware/cache/index.ts#L58) - -:::tip - -Below are advanced methods for using cache. You should use `cache.tryGet()` most of the time. - -Note that you need to use `JSON.parse()` when retrieving the cache using `cache.get()`. - -::: - -### cache.get(key [, refresh ]) - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| key | `string` | *(Required)* The key used to retrieve the cache. You can use `:` as a separator to create a hierarchy. | -| refresh | `boolean` | *(Optional)* Whether to renew the cache expiration time when the cache is hit. `true` by default. | - -### cache.set(key, value [, maxAge ]) - -#### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| key | `string` | *(Required)* The key used to store the cache. You can use `:` as a separator to create a hierarchy. | -| value | `function`\| `string` | *(Required)* The value to be cached. | -| maxAge | `number` | *(Optional)* The maximum age of the cache in seconds. If not specified, `CACHE_CONTENT_EXPIRE` will be used. | diff --git a/website/docs/joinus/new-radar.md b/website/docs/joinus/new-radar.md deleted file mode 100644 index aa82ef3ac..000000000 --- a/website/docs/joinus/new-radar.md +++ /dev/null @@ -1,299 +0,0 @@ ---- -sidebar_position: 3 ---- - -# New RSSHub Radar Rules - -:::warning - -The following document is the old version standard, please refer [/lib/types.ts#L183](https://github.com/DIYgod/RSSHub/blob/master/lib/types.ts#L183) to the new version standard - -::: - -If you want to see the results, we suggest you install the browser extension. You can download it for your browser on the [Join Us](/joinus/quick-start#submit-new-rsshub-radar-rules-before-you-start) page. - -## Code the rule - -To create a new RSS feed, create a file called `radar.ts` under the corresponding namespace in [/lib/routes/](https://github.com/DIYgod/RSSHub/tree/master/lib/routes). We will continue to use the example of creating an RSS feed for `GitHub Repo Issues`, which is described [here](/joinus/new-rss/before-start). The resulting code will look like this: - -```js -export default { - 'github.com': { - _name: 'GitHub', - '.': [ - { - title: 'Repo Issues', - docs: 'https://docs.rsshub.app/routes/programming#github', - source: ['/:user/:repo/issues/:id', '/:user/:repo/issues', '/:user/:repo'], - target: '/github/issue/:user/:repo', - }, - ], - }, -}; -``` - -## Top-level Object key - -The object key is the domain name without any subdomains, URL path, or protocol. - -![Struction of a URL](https://wsrv.nl/?url=https://enwpgo.files.wordpress.com/2022/10/image-30.png&output=webp) - -In this case, the domain name is `github.com`, so the object key is `github.com`. - -## Inner object key - -The first inner object key is `_name`, which is the name of the website. This should be the same as the level 2 heading (`##`) of the route documentation. In this case, it's `GitHub`. - -The rest of the inner object keys are the subdomains of a website. If a website you want to match does not have any subdomains, or you want to match both `www.example.com` and `example.com`, use `'.'` instead. In this case, we will use `'.'` since we want to match `github.com`. Note that each subdomain should return **an array of objects**. - - - - -```js -export default { - 'github.com': { - _name: 'GitHub', - // highlight-next-line - '.': [ - { - title: '...', - docs: '...', - source: ['/...'], - target: '/...', - }, - ], - }, -}; -``` - - - - -```js -export default { - 'github.com': { - _name: 'GitHub', - // highlight-next-line - abc: [ - { - title: '...', - docs: '...', - source: ['/...'], - target: '/...', - }, - ], - }, -}; -``` - - - - -```js -export default { - 'github.com': { - _name: 'GitHub', - // highlight-next-line - 'abc.def': [ - { - title: '...', - docs: '...', - source: ['/...'], - target: '/...', - }, - ], - }, -}; -``` - - - - -### `title` - -The title is a *required* field and should be the same as the level 3 heading (`###`) of the route documentation. In this case, it's `Repo Issues`. Do not repeat the website name (`_name`), which is `GitHub`, in `title`. - -### `docs` - -The documentation link is also a *required* field. In this case, the documentation link for `GitHub Repo Issues` will be `https://docs.rsshub.app/routes/programming#github`. - -Note that the hash should be positioned to the level 2 heading (`##`), and not `https://docs.rsshub.app/routes/programming#github-repo-issues`. - -### `source` - -The source field is *optional* and should specifies the URL path. Leave it blank if you don't want to match any URL paths. It only appears in `RSSHub for the current site` option of the RSSHub Radar browser extension. - -The source should be an array of strings. For example, if the source for `GitHub Repo Issues` is `/:user/:repo`, it means that when you visit `https://github.com/DIYgod/RSSHub`, which matches the `github.com/:user/:repo` pattern, the parameters for this URL will be: `{user: 'DIYgod', repo: 'RSSHub'}`. The browser extension uses these parameters to create an RSSHub subscription address based on the `target` field. - -:::warning - -If the value you want to extract is in the URL search parameters or URL hash, use target as a function instead of the `source` field. Also, remember that the `source` field only matches the URL path and not any other parts of the URL. - -::: - -You can use the `*` symbol to perform wildcard matching. Note that the syntax here is not the same as the [path-to-regexp](https://github.com/pillarjs/path-to-regexp). For instance, `/:user/:repo/*` will match both `https://github.com/DIYgod/RSSHub/issues` and `https://github.com/DIYgod/RSSHub/issues/1234`. If you want to name the matching result, you can place the variable name after the `*` symbol. For example, `/user/:repo/*path`, whereby path will be `issues` and `issues/1234` in the above scenario. - -### `target` - -The target field is *optional* and is used to generate an RSSHub subscription address. It accepts both a string or a function. If you don't want to create an RSSHub subscription address, leave this field empty. - -For the `GitHub Repo Issues` example, the corresponding route path in the RSSHub documentation is `/github/issue/:user/:repo`. - -After matching the `user` with `DIYgod` and `repo` with `RSSHub` in the source path, the `:user` in the RSSHub route path will be replaced with `DIYgod`, and `:repo` will be replaced with `RSSHub`, resulting in `/github/issue/DIYgod/RSSHub`. - -#### `target` as a function - -In some cases, the source path may not match the desired parameters for an RSSHub route. In these situations, we can use the `target` field as a function with `params`, `url`, and `document` parameters. - -The `params` parameter contains the parameters matched by the `source` field, while the `url` parameter is the current web page URL string, and the `document` parameter is the [document interface](https://developer.mozilla.org/docs/Web/API/document). - -It is essential to note that the `target` method runs in a sandbox, and any changes made to `document` will not be reflected in the web page. - -Here are two examples of how to use the `target` field as a function: - - - - -```js -export default { - 'github.com': { - _name: 'GitHub', - '.': [ - { - title: 'Repo Issues', - docs: 'https://docs.rsshub.app/routes/programming#github', - source: ['/:user/:repo/issues/:id', '/:user/:repo/issues', '/:user/:repo'], - // highlight-next-line - target: (params) => `/github/issue/${params.user}/${params.repo}`, - }, - ], - }, -}; -``` - - - - -```js -export default { - 'github.com': { - _name: 'GitHub', - '.': [ - { - title: 'Repo Issues', - docs: 'https://docs.rsshub.app/routes/programming#github', - source: ['/:user/:repo'], - // highlight-next-line - target: (_, url) => `/github/issue${new URL(url).pathname}` - }, - ], - }, -}; -``` - - - - -Both the above examples will return the same RSSHub subscription address as the [first example](/joinus/new-radar#code-the-rule). - -### RSSBud - -[RSSBud](https://github.com/Cay-Zhang/RSSBud) supports RSSHub Radar rules and will also be updated automatically, but please note that: - -- Use `'.'` subdomain allows RSSBud to support common mobile domains such as `m` / `mobile` -- Use `document` in `target` does not apply to RSSBud: RSSBud is not a browser extension, it only fetches and analyzes the URL of a website, it cannot run JavaScript - -## Debugging Radar Rules - -You can debug your radar rules in the RSSHub Radar extension settings of your browser. First, open the settings and switch to the "List of rules" tab. Then scroll down to the bottom of the page and you will see a text field. Here, you can replace the old rules with your new rules for debugging. - -If you are worried about losing the original RSSHub radar, don't be. It will be restored if you click the "Update Now" button in the settings page. - -Here's an example radar rule that you can play with: - -```js -({ - 'github.com': { - _name: 'GitHub', - '.': [ - { - title: 'Repo Issues', - docs: 'https://docs.rsshub.app/routes/programming#github', - source: ['/:user/:repo/issues/:id', '/:user/:repo/issues', '/:user/:repo'], - target: '/github/issue/:user/:repo', - }, - ], - }, -}) -``` - -:::note Extra examples - -```js -({ - 'bilibili.com': { - _name: 'bilibili', - www: [ - { - title: '分区视频', - docs: 'https://docs.rsshub.app/social-media#bilibili', - source: '/v/*tpath', - target: (params) => { - let tid; - switch (params.tpath) { - case 'douga/mad': - tid = '24'; - break; - default: - return false; - } - return `/bilibili/partion/${tid}`; - }, - }, - ], - }, - 'twitter.com': { - _name: 'Twitter', - '.': [ - { - // for twitter.com - title: '用户时间线', - docs: 'https://docs.rsshub.app/social-media#twitter', - source: '/:id', - target: (params) => { - if (params.id !== 'home') { - return '/twitter/user/:id'; - } - }, - }, - ], - }, - 'pixiv.net': { - _name: 'Pixiv', - www: [ - { - title: '用户收藏', - docs: 'https://docs.rsshub.app/social-media#pixiv', - source: '/bookmark.php', - target: (params, url) => `/pixiv/user/bookmarks/${new URL(url).searchParams.get('id')}`, - }, - ], - }, - 'weibo.com': { - _name: '微博', - '.': [ - { - title: '博主', - docs: 'https://docs.rsshub.app/social-media#%E5%BE%AE%E5%8D%9A', - source: ['/u/:id', '/:id'], - target: (params, url, document) => { - const uid = document && document.documentElement.innerHTML.match(/\$CONFIG\['oid']='(\d+)'/)[1]; - return uid ? `/weibo/user/${uid}` : ''; - }, - }, - ], - }, -}) -``` - -::: diff --git a/website/docs/joinus/new-rss/_category_.json b/website/docs/joinus/new-rss/_category_.json deleted file mode 100644 index 64278cf29..000000000 --- a/website/docs/joinus/new-rss/_category_.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "label": "New RSSHub Rules", - "position": 2, - "collapsed": false -} diff --git a/website/docs/joinus/new-rss/before-start.md b/website/docs/joinus/new-rss/before-start.md deleted file mode 100644 index 08259cda6..000000000 --- a/website/docs/joinus/new-rss/before-start.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -sidebar_position: 2 ---- - -# Just before you start - -In this tutorial, we will walk you through the process of creating an RSS feed for [GitHub Repo Issues](/routes/programming#github-repo-issues) as an example. - -## Install dependencies - -Before you start, you need to install the dependencies for RSSHub. You can do this by running the following command in the root directory of RSSHub: - -```bash -pnpm i -``` - -## Start debugging - -Once you have successfully installed the dependencies, you can start debugging RSSHub by running the following command: - -```bash -pnpm dev -``` - -Make sure to keep an eye on the console output for any error messages or other useful information that can help you diagnose and resolve issues. Additionally, don't hesitate to consult the RSSHub documentation or seek help from the community if you encounter any difficulties. - -To view the result of your changes, open `http://localhost:1200` in your browser. You'll be able to see the changes you made to the code automatically reflected in the browser. - -## Follow the Script Standard - -It's important to ensure that all new RSS routes adhere to the [Script Standard](/joinus/advanced/script-standard). Failure to comply with this standard may result in your Pull Request not being merged in a reasonable timeframe. - -The [Script Standard](/joinus/advanced/script-standard) provides guidelines for creating high-quality and reliable source code. By following these guidelines, you can ensure that your RSS feed works as intended and is easy for other community maintainers to read. - -Before submitting your Pull Request, make sure to carefully review the [Script Standard](/joinus/advanced/script-standard) and ensure that your code meets all of the requirements. This will help to expedite the review process. diff --git a/website/docs/joinus/new-rss/prerequisites.md b/website/docs/joinus/new-rss/prerequisites.md deleted file mode 100644 index bcdffb156..000000000 --- a/website/docs/joinus/new-rss/prerequisites.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Prerequisites - -Before you begin, it is important that your development environment set up properly. - -## Install Node.js - -To be able to write new RSS rules, you must first install Node.js first. RSSHub uses Node.js to run its code and create RSS feeds and requires Node v16 or above. You can download the latest LTS version of Node.js from [here](https://nodejs.org/en/download). - -On Windows, you can simply download the installer and follow the steps from the installer. Remember to check the option to install **Tools for Native Modules** as well. - -On macOS, you can either download the installer from the Node.js website or use [Homebrew](https://brew.sh) to install Node.js with the command `brew install node`. - -On Linux, you can refer to [this page](https://nodejs.org/en/download/package-manager) to decide how to install Node.js. - -## Install a code editor - -To write code, you need a code editor. If you already have one, you can skip this section. If you don't have one, you can choose one from the following list: - -- [Visual Studio Code](https://code.visualstudio.com) -- [WebStorm](https://www.jetbrains.com/webstorm) -- [Neovim](https://neovim.io) -- [Sublime Text](https://www.sublimetext.com) - -To speed up the development process and make it easier to keep your code clean, you can install some appropriate extensions to the code editor of your choice. In the latter part of this guide, we will use Visual Studio Code as an example, you can install the following extensions: - -- [Art Template Helper](https://marketplace.visualstudio.com/items?itemName=ZihanLi.at-helper)(provides syntax highlighting for a template engine used by RSSHub) -- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)(maintain consistent coding styles across different editors and IDEs) -- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)(identify and fix common errors in your code) -- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)(formats your code to make it more readable and consistent) - -### Cloud hosted development environment - -If you don't want to install Node.js and a code editor on your computer, you can use a cloud-hosted development environment. You may use [GitHub Codespaces](https://codespace.new/) or [Gitpod](https://www.gitpod.io). Just click one of the buttons below to start a new workspace: - -[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/DIYgod/RSSHub?quickstart=1) - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/DIYgod/RSSHub) - -For more information about how to use [GitHub Codespaces](https://codespace.new/) or [Gitpod](https://www.gitpod.io/) , see [GitHub's documentation](https://docs.github.com/codespaces) and [Gitpod's documentation](https://www.gitpod.io/docs/). diff --git a/website/docs/joinus/new-rss/start-code.md b/website/docs/joinus/new-rss/start-code.md deleted file mode 100644 index 1333b82b3..000000000 --- a/website/docs/joinus/new-rss/start-code.md +++ /dev/null @@ -1,925 +0,0 @@ ---- -sidebar_position: 3 ---- - -# Create Route - -## Creating Namespace - -The first step to making a new RSS route is to create a namespace. In principle, the namespace should be **the same** as the secondary domain of the main website where you are making the RSS feed. For example, if you are making an RSS feed for [https://github.com/DIYgod/RSSHub/issues](https://github.com/DIYgod/RSSHub/issues), the secondary domain is `github`. Therefore, you should create a folder named `github` under `lib/routes` as the namespace for your RSS route. - -:::tip - -When creating a namespace, avoid creating multiple variations for the same namespace. For example, if you are making RSS feeds for `yahoo.co.jp` and `yahoo.com`, you should use a single namespace `yahoo` rather than creating multiple namespaces like `yahoo-jp`, `yahoojp`, `yahoo.jp`, `jp.yahoo`, `yahoocojp` and so on. - -::: - -Once you have created a namespace for the RSS route, the next step is to create the file `namespace.ts` to define the namespace. - -The file should return an object that conforms to the Namespace type through a namespace. The definition of Namespace is at [/lib/types.ts](https://github.com/DIYgod/RSSHub/blob/master/lib/types.ts#L51) - -- name: The human-readable name of the namespace, which will be used as the title of the document -- url: The website URL without protocol that corresponds -- description: Optional, hints and additional explanations for users using this namespace, it will be inserted into the document -- zh, zh-TW, ja: optional, support for languages other than English, it will be used to generate multilingual documents - -Here is a complete example: - -```ts -import type { Namespace } from '@/types'; - -export const namespace: Namespace = { - name: 'GitHub', - url: 'github.com', - description: ` -:::tip -GitHub provides some official RSS feeds: - -- Repo releases: \`https://github.com/:owner/:repo/releases.atom\` -- Repo commits: \`https://github.com/:owner/:repo/commits.atom\` -- User activities: \`https://github.com/:user.atom\` -- Private feed: \`https://github.com/:user.private.atom?token=:secret\` (You can find **Subscribe to your news feed** in [dashboard](https://github.com) page after login) -- Wiki history: \`https://github.com/:owner/:repo/wiki.atom\` -:::`, - - zh: { - name: '给他哈不', - }, -}; -``` - -## Creating Route - -Once you have created a namespace for the route, the next step is to create a route file to register the route. - -For example, if you are making an RSS feed for [GitHub Repo Issues]((/routes/programming#github-yong-hu-cang-ku)), and assume that you want users to enter the GitHub username and repo name, if they do not enter the repo name, they will return to RSSHub. You can register your new RSS route in /lib/routes/github/issue.ts, the file needs to return an object that conforms to the Route type through route. The definition of Route is at [/lib/types.ts](https://github.com/DIYgod/RSSHub/blob/master/lib/types.ts#L86) - -- path: The route path, using [Hono routing](https://hono.dev/api/routing) syntax -- name: The human-readable name of the route, which will be used as the title of the document -- url: The website URL without protocol that corresponds -- maintainers: The GitHub handle of the people responsible for maintaining this route -- example: An example URL of the route -- parameters: The description of the route parameters -- description: Optional, hints and additional explanations for users using this route, it will be inserted into the document -- categories: The classification of the route, which will be written into the corresponding classification document -- features: Some features of the route, such as what configuration items it depends on, whether it is strict anti-crawl, whether it supports a certain function and so on -- radar: Can help users subscribe to your new RSS route when using [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) or other software compatible with its format, we will introduce it more in the following sections -- handler: The handler function of the route, we will introduce it more in the following sections - -Here is a complete example: - -```ts -import { Route } from '@/types'; - -export const route: Route = { - path: '/issue/:user/:repo/:state?/:labels?', - categories: ['programming'], - example: '/github/issue/vuejs/core/all/wontfix', - parameters: { user: 'GitHub username', repo: 'GitHub repo name', state: 'the state of the issues. Can be either `open`, `closed`, or `all`. Default: `open`.', labels: 'a list of comma separated label names' }, - features: { - requireConfig: false, - requirePuppeteer: false, - antiCrawler: false, - supportBT: false, - supportPodcast: false, - supportScihub: false, - }, - radar: { - source: ['github.com/:user/:repo/issues', 'github.com/:user/:repo/issues/:id', 'github.com/:user/:repo'], - target: '/issue/:user/:repo', - }, - name: 'Repo Issues', - maintainers: ['HenryQW', 'AndreyMZ'], - handler, -}; -``` - -In the above example, `issue` is an exact match, `:user` is a required parameter, `:repo?` is an optional parameter. `?` after `:repo` indicates that the parameter is optional - -## Writing Route Handler Function - -The handler function will be passed a parameter ctx. By the end of the function, it needs to return an object that contains the information required for RSS. - -You can see the APIs available for ctx to use in the [Hono context documentation]((https://hono.dev/api/context)) - -The type of the return value is defined here: [/lib/types.ts#L37](https://github.com/DIYgod/RSSHub/blob/master/lib/types.ts#L37) - -As mentioned earlier, we will create an RSS feed for [GitHub Repo Issues](/routes/programming#github-repo-issues) as an example. We will show all four data collection methods mentioned: - -1. [Via API](#via-api) -2. [Via HTML web page using got](#via-html-web-page-using-got) -3. [Using the Common Configured Route](#using-the-common-configured-route) -4. [Using puppeteer](#using-puppeteer) - -:::warning - -The following example code is based on an old standard, the differences are: - -- Previously, the handler function would be returned as a whole, now it is only returned as a part of the route object. -- Previously, the handler function would save the RSS information in ctx.set('data') without a return value, now the RSS information needs to be returned as the return value of the handler function. - -::: - -## Via API - -### Check the API documentation - -Different sites have different APIs. You can check the API documentation for the site you want to create an RSS feed for. In this case, we will use the [GitHub Issues API](https://docs.github.com/en/rest/issues/issues#list-repository-issues). - -### Create the main file - -Open your code editor and create a new file. Since we are going to create an RSS feed for GitHub issues, it is suggested that you save the file as `issue.ts`, but you can name it whatever you like. - -Here's the basic code to get you started: - - - - -```js -// Import the necessary modules -import got from '@/utils/got'; // a customised got -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - // Your logic here - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - - - - -### Retrieving user input - -As mentioned earlier, we need to retrieve the GitHub username and repository name from user input. The repository name should default to `RSSHub` if it is not provided in the request URL. Here's how you can do it: - - - - -```js -export default async (ctx) => { - // highlight-next-line - const { user, repo = 'RSSHub' } = ctx.req.param(); - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - - - - -```js -export default async (ctx) => { - // highlight-start - const user = ctx.req.param('user'); - const repo = ctx.req.param('repo') ?? 'RSSHub'; - // highlight-end - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - - - - -Both of these code snippets do the same thing. The first one uses object destructuring to assign the `user` and `repo` variables, while the second one uses traditional assignment with a nullish coalescing operator to assign the `repo` variable a default value of `RSSHub` if it is not provided in the request URL. - -### Getting data from the API - -After we have the user input, we can use it to make a request to the API. In most cases, you will need to use `got` from `@/utils/got` (a customized got wrapper) to make HTTP requests. For more information, please refer to the [got documentation](https://github.com/sindresorhus/got/tree/v11#usage). - - - - -```js -export default async (ctx) => { - const { user, repo = 'RSSHub' } = ctx.req.param(); - // highlight-start - // Send an HTTP GET request to the API - // and destruct the data object returned by the request - const { data } = await got(`https://api.github.com/repos/${user}/${repo}/issues`, { - headers: { - // This example uses HTML for simplicity instead of the - // recommended 'application/vnd.github+json', which returns - // Markdown and requires additional processing - accept: 'application/vnd.github.html+json', - }, - searchParams: { - // This allows users to set the number of feed items they want - per_page: ctx.req.query('limit') ? parseInt(ctx.req.query('limit'), 10) : 30, - }, - }); - // highlight-end - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - - - - -```js -export default async (ctx) => { - const user = ctx.req.param('user'); - const repo = ctx.req.param('repo') ?? 'RSSHub'; - // highlight-start - // Send an HTTP GET request to the API - const response = await got(`https://api.github.com/repos/${user}/${repo}/issues`, { - headers: { - accept: 'application/vnd.github.html+json', - }, - searchParams: { - per_page: ctx.req.query('limit') ? parseInt(ctx.req.query('limit'), 10) : 30, - }, - }); - // response.data is the data object returned by the above request - const data = response.data; - // highlight-end - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - - - - -### Outputting the RSS - -Once we have retrieved the data from the API, we need to process it further to generate an RSS feed that conforms to the RSS specification. Specifically, we need to extract the channel title, channel link, item title, item link, item description, and item publication date. - -To do this, we can assign the relevant data to the `ctx.set('data', obj)` object, and RSSHub's middleware will take care of the rest. - -Here is the final code that you should have: - - - - -```js -import got from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - const { user, repo = 'RSSHub' } = ctx.req.param(); - - const { data } = await got(`https://api.github.com/repos/${user}/${repo}/issues`, { - headers: { - accept: 'application/vnd.github.html+json', - }, - searchParams: { - per_page: ctx.req.query('limit') ? parseInt(ctx.req.query('limit'), 10) : 30, - }, - }); - - // highlight-start - // extract the relevant data from the API response - const items = data.map((item) => ({ - // item title - title: item.title, - // item link - link: item.html_url, - // item description - description: item.body_html, - // item publish date or time - pubDate: parseDate(item.created_at), - // item author, if available - author: item.user.login, - // item category, if available - category: item.labels.map((label) => label.name), - })); - // highlight-end - - // highlight-start - ctx.set('data', { - // channel title - title: `${user}/${repo} issues`, - // channel link - link: `https://github.com/${user}/${repo}/issues`, - // each feed item - item: items, - }); - // highlight-end -}; -``` - - - - -```js -import got from '@/utils/got'; -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - const { user, repo = 'RSSHub' } = ctx.req.param(); - - const { data } = await got(`https://api.github.com/repos/${user}/${repo}/issues`, { - headers: { - accept: 'application/vnd.github.html+json', - }, - searchParams: { - per_page: ctx.req.query('limit') ? parseInt(ctx.req.query('limit'), 10) : 30, - }, - }); - - // highlight-start - ctx.set('data', { - // channel title - title: `${user}/${repo} issues`, - // channel link - link: `https://github.com/${user}/${repo}/issues`, - // iterate through all leaf objects - item: data.map((item) => ({ - // item title - title: item.title, - // item link - link: item.html_url, - // item description - description: item.body_html, - // item publish date or time - pubDate: parseDate(item.created_at), - // item author, if available - author: item.user.login, - // item category, if available - category: item.labels.map((label) => label.name), - })); - }); - // highlight-end -}; -``` - - - - -## Via HTML web page using got - -### Create the main file - -To start, open your code editor and create a new file. Since we are going to create an RSS feed for GitHub issues, it is suggested that you save the file as `issue.ts`. However, you can also name it whatever you like. - -Here's the basic code to get you started: - -```js -// Require necessary modules -import got from '@/utils/got'; // a customised got -import { load } from 'cheerio'; // an HTML parser with a jQuery-like API -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - // Your logic here - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - -The `parseDate` function is a utility function provided by RSSHub that we will use to parse dates later in the code. - -You will add your own code to extract data from the HTML document, process it, and output it in RSS format. We will cover the details of this process in the next steps. - -### Retrieving user input - -As mentioned before, we want users to enter a GitHub username and a repository name, and fall back to `RSSHub` if they don't enter the repository name in the request URL. - -```js -export default async (ctx) => { - // highlight-start - // Retrieve user and repository name from the URL parameters - const { user, repo = 'RSSHub' } = ctx.req.param(); - // highlight-end - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - -In this code, `user` will be set to the value of `user` parameter, and `repo` will be set to the value of `repo` parameter if it exists, and `RSSHub` otherwise. - -### Getting data from the web page - -After receiving the user input, we need to make a request to the web page to retrieve the information we need. In most cases, we'll use `got` from `@/utils/got` (a customized [got](https://www.npmjs.com/package/got) wrapper) to make HTTP requests. You can find more information on how to use got in the [got documentation](https://github.com/sindresorhus/got/tree/v11#usage). - -To begin, we'll make an HTTP GET request to the API and load the HTML response into Cheerio, a library that helps us parse and manipulate HTML. - -```js - const baseUrl = 'https://github.com'; - const { user, repo = 'RSSHub' } = ctx.req.param(); - - // Note that the ".data" property contains the full HTML source of the target page returned by the request - // highlight-start - const { data: response } = await got(`${baseUrl}/${user}/${repo}/issues`); - const $ = load(response); - // highlight-end -``` - -Next, we'll use Cheerio selectors to select the relevant HTML elements, parse the data we need, and convert it into an array. - -```js - // We use a Cheerio selector to select all 'div' elements with the class name 'js-navigation-container' - // that contain child elements with the class name 'flex-auto'. - // highlight-start - const items = $('div.js-navigation-container .flex-auto') - // We use the `toArray()` method to retrieve all the DOM elements selected as an array. - .toArray() - // We use the `map()` method to traverse the array and parse the data we need from each element. - .map((item) => { - item = $(item); - const a = item.find('a').first(); - return { - title: a.text(), - // We need an absolute URL for `link`, but `a.attr('href')` returns a relative URL. - link: `${baseUrl}${a.attr('href')}`, - pubDate: parseDate(item.find('relative-time').attr('datetime')), - author: item.find('.opened-by a').text(), - category: item - .find('a[id^=label]') - .toArray() - .map((item) => $(item).text()), - }; - }); - // highlight-end - - ctx.set('data', { - // Your RSS output here - }); -``` - -### Outputting the RSS - -Once we have the data from the web page, we need to further process it to generate RSS in accordance with the RSS specification. Mainly, we need the channel title, channel link, item title, item link, item description, and item publication date. - -Pass them to the `ctx.set('data', obj)` object, and RSSHub's middleware will take care of the rest. - -Here's an example code: - -```js -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - const baseUrl = 'https://github.com'; - const { user, repo = 'RSSHub' } = ctx.req.param(); - - const { data: response } = await got(`${baseUrl}/${user}/${repo}/issues`); - const $ = load(response); - - const items = $('div.js-navigation-container .flex-auto') - .toArray() - .map((item) => { - item = $(item); - const a = item.find('a').first(); - return { - title: a.text(), - link: `${baseUrl}${a.attr('href')}`, - pubDate: parseDate(item.find('relative-time').attr('datetime')), - author: item.find('.opened-by a').text(), - category: item - .find('a[id^=label]') - .toArray() - .map((item) => $(item).text()), - }; - }); - - // highlight-start - ctx.set('data', { - // channel title - title: `${user}/${repo} issues`, - // channel link - link: `${baseUrl}/${user}/${repo}/issues`, - // each feed item - item: items, - }); - // highlight-end -}; -``` - -### Better Reading Experience - -The previous code provides only part of the information for each feed item. To provide a better reading experience, we can add the full article to each feed item, in this case the issue body. - -Here's the updated code: - -```js -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - const baseUrl = 'https://github.com'; - const { user, repo = 'RSSHub' } = ctx.req.param(); - - const { data: response } = await got(`${baseUrl}/${user}/${repo}/issues`); - const $ = load(response); - - // highlight-next-line - const list = $('div.js-navigation-container .flex-auto') - .toArray() - .map((item) => { - item = $(item); - const a = item.find('a').first(); - return { - title: a.text(), - link: `${baseUrl}${a.attr('href')}`, - pubDate: parseDate(item.find('relative-time').attr('datetime')), - author: item.find('.opened-by a').text(), - category: item - .find('a[id^=label]') - .toArray() - .map((item) => $(item).text()), - }; - }); - - // highlight-start - const items = await Promise.all( - list.map((item) => - cache.tryGet(item.link, async () => { - const { data: response } = await got(item.link); - const $ = load(response); - - // Select the first element with the class name 'comment-body' - item.description = $('.comment-body').first().html(); - - // Every property of a list item defined above is reused here - // and we add a new property 'description' - return item; - }) - ) - ); - // highlight-end - - ctx.set('data', { - title: `${user}/${repo} issues`, - link: `https://github.com/${user}/${repo}/issues`, - // highlight-next-line - item: items, - }); -}; - -``` - -Now the RSS feed will have a similar reading experience to the original website. - -:::tip - -Note that in the previous section, we only needed to send one HTTP request using an API to get all the data we needed. However, in this section, we need to send `1 + n` HTTP requests, where `n` is the number of feed items in the list from the first request. - -Some websites may not want to receive too many requests in a short amount of time, which can cause them to return an error message like `429 Too Many Requests`. - -::: - -## Using the common configured route - -### Create the main file - -First, we need a few data: - -1. The RSS source link -2. The data source link -3. The RSS feed title (not the title of individual items) - -Open your code editor and create a new file. Since we're going to create an RSS feed for GitHub issues, it's suggested that you save the file as `issue.ts`, but you can name it whatever you like. - -Here's some basic code to get you started: - -```js -// Import necessary modules -import buildData from '@/utils/common-config'; - -export default async (ctx) => { - ctx.set('data', await buildData({ - link: '', // The RSS source link - url: '', // The data source link - // Variables can be used here, such as %xxx% will be parsed into - // variables with values of the same name under **params** - title: '%title%', - params: { - title: '', // Additional title - }, - })); -}; -``` - -Our RSS feed currently lacks content. The `item` must be set to add the content. Here's an example: - -```js -import buildData from '@/utils/common-config'; - -export default async (ctx) => { - const { user, repo = 'RSSHub' } = ctx.req.param(); - const link = `https://github.com/${user}/${repo}/issues`; - - ctx.set('data', await buildData({ - link, - url: link, - title: `${user}/${repo} issues`, // you can also use $('head title').text() - params: { - title: `${user}/${repo} issues`, - baseUrl: 'https://github.com', - }, - // highlight-start - item: { - item: 'div.js-navigation-container .flex-auto', - // You need to use template literals if you want to use variables - title: `$('a').first().text() + ' - %title%'`, // Only supports js statements like $().xxx() - link: `'%baseUrl%' + $('a').first().attr('href')`, // .text() means get the text of the element - // description: ..., we don't have description for now - pubDate: `parseDate($('relative-time').attr('datetime'))`, - }, - // highlight-end - })); -}; -``` - -You'll notice that the code is similar to the [Obtaining data from the webpage](#getting-data-from-the-web-page) section above. However, this RSS feed doesn't contain the full article of the issue. - -### Retrieving full articles - -To get the full article of each issue, you need to add a few more lines of code. Here is an example: - -```js -import buildData from '@/utils/common-config'; -// highlight-start -import got from '@/utils/got'; -import { load } from 'cheerio'; -// highlight-end - -export default async (ctx) => { - const { user, repo = 'RSSHub' } = ctx.req.param(); - const link = `https://github.com/${user}/${repo}/issues`; - - const data = await buildData({ - link, - url: link, - title: `${user}/${repo} issues`, - params: { - title: `${user}/${repo} issues`, - baseUrl: 'https://github.com', - }, - item: { - item: 'div.js-navigation-container .flex-auto', - title: `$('a').first().text() + ' - %title%'`, - link: `'%baseUrl%' + $('a').first().attr('href')`, - pubDate: `parseDate($('relative-time').attr('datetime'))`, - }, - }); - - // highlight-start - await Promise.all( - data.item.map((item) => - cache.tryGet(item.link, async () => { - const { data: resonse } = await got(item.link); - const $ = load(resonse); - item.description = $('.comment-body').first().html(); - return item; - }) - ) - ); - - ctx.set('data', data); - // highlight-end -}; -``` - -You can see that the above code is very similar to the [previous section](#better-reading-experience) which retrieves full articles by adding a few more lines of code. It is recommended that you use the method in the [previous section](#better-reading-experience) whenever possible, as it is more flexible than using `@/utils/common-config`. - -## Using puppeteer - -Using puppeteer is another approach to obtain data from websites. However, it is recommended that you try the [above methods](#via-html-web-page-using-got) first. It is also recommended that you read [via HTML web page using got](#via-html-web-page-using-got) first since this section is an extension of the previous section and will not explain some basic concepts. - -### Create the main file - -To get started with puppeteer, create a new file in your code editor and save it with an appropriate name, such as `issue.ts`. Then, require the necessary modules and set up the basic structure of the function: - -```js -// Require some useful modules -import { load } from 'cheerio'; // an HTML parser with a jQuery-like API -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; - -export default async (ctx) => { - // Your logic here - - ctx.set('data', { - // Your RSS output here - }); -}; -``` - -### Replace got with puppeteer - -Now, we will be using `puppeteer` instead of `got` to retrieve data from the web page. - - - - -```js -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; -import puppeteer from '@/utils/puppeteer'; - -export default async (ctx) => { - const baseUrl = 'https://github.com'; - const { user, repo = 'RSSHub' } = ctx.req.param(); - - // highlight-start - // require puppeteer utility class and initialise a browser instance - const browser = await puppeteer(); - // open a new tab - const page = await browser.newPage(); - // intercept all requests - await page.setRequestInterception(true); - // only allow certain types of requests to proceed - page.on('request', (request) => { - // in this case, we only allow document requests to proceed - request.resourceType() === 'document' ? request.continue() : request.abort(); - }); - // visit the target link - const link = `${baseUrl}/${user}/${repo}/issues`; - // got requests will be logged automatically - // but puppeteer requests are not - // so we need to log them manually - logger.http(`Requesting ${link}`); - await page.goto(link, { - // specify how long to wait for the page to load - waitUntil: 'domcontentloaded', - }); - // retrieve the HTML content of the page - const response = await page.content(); - // close the tab - page.close(); - // highlight-end - - const $ = load(response); - - // const item = ...; - - // highlight-start - // don't forget to close the browser instance at the end of the function - browser.close(); - // highlight-end - - ctx.set('data', { - // Your RSS output here - }); -} -``` - - - - -```js -import got from '@/utils/got'; -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; - -export default async (ctx) => { - const baseUrl = 'https://github.com'; - const { user, repo = 'RSSHub' } = ctx.req.param(); - - // highlight-next-line - const { data: response } = await got(`${baseUrl}/${user}/${repo}/issues`); - const $ = load(response); - - ctx.set('data', { - // Your RSS output here - }); -} -``` - - - - -### Retrieving full articles - -Retrieving the full articles of each issue using a new browser page is similar to the [previous section](#better-reading-experience). We can use the following code: - -```js -import { load } from 'cheerio'; -import { parseDate } from '@/utils/parse-date'; -import logger from '@/utils/logger'; -import puppeteer from '@/utils/puppeteer'; - -export default async (ctx) => { - const baseUrl = 'https://github.com'; - const { user, repo = 'RSSHub' } = ctx.req.param(); - - const browser = await puppeteer(); - const page = await browser.newPage(); - await page.setRequestInterception(true); - page.on('request', (request) => { - request.resourceType() === 'document' ? request.continue() : request.abort(); - }); - - const link = `${baseUrl}/${user}/${repo}/issues`; - logger.http(`Requesting ${link}`); - await page.goto(link, { - waitUntil: 'domcontentloaded', - }); - const response = await page.content(); - page.close(); - - const $ = load(response); - - const list = $('div.js-navigation-container .flex-auto') - .toArray() - .map((item) => { - item = $(item); - const a = item.find('a').first(); - return { - title: a.text(), - link: `${baseUrl}${a.attr('href')}`, - pubDate: parseDate(item.find('relative-time').attr('datetime')), - author: item.find('.opened-by a').text(), - category: item - .find('a[id^=label]') - .toArray() - .map((item) => $(item).text()), - }; - }); - - const items = await Promise.all( - list.map((item) => - cache.tryGet(item.link, async () => { - // highlight-start - // reuse the browser instance and open a new tab - const page = await browser.newPage(); - // set up request interception to only allow document requests - await page.setRequestInterception(true); - page.on('request', (request) => { - request.resourceType() === 'document' ? request.continue() : request.abort(); - }); - - logger.http(`Requesting ${item.link}`); - await page.goto(item.link, { - waitUntil: 'domcontentloaded', - }); - const response = await page.content(); - // close the tab after retrieving the HTML content - page.close(); - // highlight-end - - const $ = load(response); - - item.description = $('.comment-body').first().html(); - - return item; - }) - ) - ); - - // highlight-start - // close the browser instance after all requests are done - browser.close(); - // highlight-end - - ctx.set('data', { - title: `${user}/${repo} issues`, - link: `https://github.com/${user}/${repo}/issues`, - item: items, - }); -}; -``` - -### Additional Resources - -Here are some resources you can use to learn more about puppeteer: - -- [puppeteer's good ol' docs](https://github.com/puppeteer/puppeteer/blob/v15.2.0/docs/api.md) -- [puppeteer's current docs](https://pptr.dev) - -#### Intercepting requests - -When scraping web pages, you may encounter images, fonts, and other resources that you don't need. These resources can slow down the page load time and use up valuable CPU and memory resources. To avoid this, you can enable request interception in puppeteer. - -Here's how to do it: - -```js -await page.setRequestInterception(true); -page.on('request', (request) => { - request.resourceType() === 'document' ? request.continue() : request.abort(); -}); -// These two statements must be placed before page.goto() -``` - -You can find all the possible values of `request.resourceType()` [here](https://chromedevtools.github.io/devtools-protocol/tot/Network/#type-ResourceType). When using these values in your code, make sure to use **lowercase** letters. - -#### Wait Until - -In the code above, you'll see that `waitUntil: 'domcontentloaded'` is used in the page.goto() function. This is a Puppeteer option that tells it when to consider a navigation successful. You can find all the possible values and their meanings [here](https://pptr.dev/api/puppeteer.page.goto/#remarks). - -It's worth noting that `domcontentloaded`waits for a shorter time than the default value `load`, and `networkidle0` may not be suitable for websites that keep sending background telemetry or fetching data. - -Additionally, it's important to avoid waiting for a specific timeout and instead wait for a selector to appear. Waiting for a timeout is inaccurate, as it depends on the load of the Puppeteer instance. diff --git a/website/docs/joinus/new-rss/submit-route.md b/website/docs/joinus/new-rss/submit-route.md deleted file mode 100644 index 2a3d1ffb1..000000000 --- a/website/docs/joinus/new-rss/submit-route.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -sidebar_position: 5 ---- - -# Submit your route - -Once you have finished your route, you can submit a pull request (hereafter referred to as PR) to [RSSHub](https://github.com/DIYgod/RSSHub). We use a squash merge strategy, meaning all commits in your branch will be merged into one commit on RSSHub's repository. However, keeping your commit history clean and tidy is still important. We've also provided an intuitive template for you to fill out. - -## Pull Request Template - -````md - - -## Involved Issue / 该 PR 相关 Issue - -Close # - -## Example for the Proposed Route(s) / 路由地址示例 - - - -```routes -``` - -## New RSS Route Checklist / 新 RSS 路由检查表 - -- [ ] New Route / 新的路由 - - [ ] Follows [Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard) -- [ ] Documentation / 文档说明 -- [ ] Full text / 全文获取 - - [ ] Use cache / 使用缓存 -- [ ] Anti-bot or rate limit / 反爬/频率限制 - - [ ] If yes, do your code reflect this sign? / 如果有, 是否有对应的措施? -- [ ] [Date and time](https://docs.rsshub.app/joinus/advanced/pub-date) / [日期和时间](https://docs.rsshub.app/zh/joinus/advanced/pub-date) - - [ ] Parsed / 可以解析 - - [ ] Correct time zone / 时区正确 -- [ ] New package added / 添加了新的包 -- [ ] `Puppeteer` - -## Note / 说明 -```` - -### Involved Issue - -You can fill in the issue number that this PR is related to here. If there's no related issue, leave it blank. If your pull request gets merged, the related issue will be automatically closed. If you want to close multiple issues, add another `Close #` separated by a space or comma. For example, `Close #123, Close #456, Close #789` or `Close #123 Close #456 Close #789`. - -### Example for the Proposed Route(s) - -Here you can add the route(s) you're proposing to **add or change**, along with all required and optional parameters. If you want to add multiple routes, add each one in a new line. For example: - -````md -```routes -/github/issue/DIYgod -/github/issue/DIYgod/RSSHub -/github/issue/DIYgod/RSSHub-Radar -/github/issue/flutter/flutter -``` -```` - -**Do not** fill in `/github/issue/:user/:repo?` or `/issue/:user/:repo?`. - -If your changes are not related to a route, such as documentation, you can fill in `routes` section with `NOROUTE`. - -````md -```routes -NOROUTE -``` -```` - -**Do not** delete or leave the `routes` section untouched, or your pull request will be automatically closed. - -**Do not** use `NOROUTE` for route-related pull requests, or they will be automatically closed as well. - -### New RSS Route Checklist - -This checklist will help you ensure that your pull request includes all necessary components. Although you don't have to check off all items to get your PR merged, please make sure that your new route follows the [Script Standard](/joinus/advanced/script-standard). This is a **mandatory** requirement for all new routes. - -```md -- [ ] 新的路由 New Route -``` - -To check off an item, replace `[ ]` with `[x]`. - -```md -- [x] 新的路由 New Route -``` - -### Note - -Use this section to include any additional information or comments you'd like to share. - -## Pull Request Title - -The pull request title will be used as the commit message when your pull request is merged. Please follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) specification. - -If you are adding a new route, including all required documentation and `radar.ts`, use `route` as the scope. If you are adding new radar rules only, use `radar` as the scope. - -## Response to Code Review - -Your pull request will be reviewed by both bots and RSSHub maintainers. You can check the details of the automated checks by clicking on the `Details` link next to the check name. -If an RSSHub maintainer requests changes, you can commit and push your changes to your branch. The pull request will automatically update to reflect your changes. You can also incorporate feedback from the maintainer in batch by using the [suggested changes feature](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request#applying-suggested-changes). - -## What's Next - -After your pull request is merged, a new docker image will be built. This process can take up to an hour since we are building for multiple platforms, including `linux/arm/v7`, `linux/arm64`, and `linux/amd64`, with and without bundled Chromium. diff --git a/website/docs/joinus/quick-start.md b/website/docs/joinus/quick-start.md deleted file mode 100644 index b3d0e2c77..000000000 --- a/website/docs/joinus/quick-start.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Quick Start - -If you've found a bug or have a suggestion for improving RSSHub, we'd love to hear from you! You can submit your changes by creating a pull request. Don't worry if you're new to pull requests - we welcome contributions from developers of all experience levels. Don't know how to code? You can also help by [reporting bugs](https://github.com/DIYgod/RSSHub/issues). - -## Join the discussion - -[![Telegram Group](https://img.shields.io/badge/chat-telegram-brightgreen.svg?logo=telegram&style=for-the-badge)](https://t.me/rsshub) [![GitHub issues](https://img.shields.io/github/issues/DIYgod/RSSHub?color=bright-green&logo=github&style=for-the-badge)](https://github.com/DIYgod/RSSHub/issues) - -## Before you begin - -To create an RSS feed, you'll need to use a combination of Git, HTML, JavaScript, jQuery, and Node.js. - -If you don't know much about them but would like to learn them, here are some good resources: - -- [JavaScript Tutorials on MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript#tutorials) -- [W3Schools](https://www.w3schools.com/) -- [Git course on Codecademy](https://www.codecademy.com/learn/learn-git) - -If you'd like to see examples of how other developers use these technologies to create RSS feeds, you can take a look at some of the code in [our repository](https://github.com/DIYgod/RSSHub/tree/master/lib/routes). - -## Submit new RSSHub rules - -If you've found a website that doesn't offer an RSS feed, you can create an RSS rule for it using RSSHub. An RSS rule is a short Node.js program code (hereafter referred to as "route") that tells RSSHub how to extract content from a website and generate an RSS feed. By creating a new RSS route, you can help make content from your favourite websites more accessible and easier to follow. - -Before you start writing an RSS route, please make sure that the source site does not provide RSS. Some web pages will include a link element with type `application/atom+xml` or `application/rss+xml` in the HTML header to indicate the RSS link. - -Here's an example of what an RSS link might look like in the HTML header: ``. If you see a link like this, it means that the website already has an RSS feed and you don't need to create a new RSS route for it. - -### Getting started - -In this guide, you'll learn how to create a new RSS route from scratch. We'll cover everything from setting up your development environment to submitting your code to the RSSHub repository. By the end of this guide, you'll be able to create your own RSS feeds for websites that don't offer them. - -[Ready to get started? Click here to dive into the guide!](/joinus/new-rss/prerequisites) - -## Submit new RSSHub Radar rules - -### Before you start - -It's recommended that you download and install RSSHub Radar in your browser before you start. - -Once you have installed RSSHub Radar, open the settings and switch to the "List of rules" tab. Then scroll down to the bottom of the page and you will see a text field. Here, you can replace the old rules with your new rules for debugging. - -[Let's start!](/joinus/new-radar) - -Get RSSHub Radar for Chromium -Get Get RSSHub Radar for Firefox -Get RSSHub Radar for Edge -Get RSSHub Radar for Safari diff --git a/website/docs/parameter.md b/website/docs/parameter.md deleted file mode 100644 index 7b0d5227f..000000000 --- a/website/docs/parameter.md +++ /dev/null @@ -1,180 +0,0 @@ -# Parameters - -:::tip - -Parameters here are actually URI query and can be linked together with `&` to generate a complex feed. - -Parameters here need to be placed after the route path. Some routes may have **custom route parameters** and **parameters here** need to be placed after them. - -E.g., https://rsshub.app/twitter/user/durov/**readable=1&includeRts=0**?**brief=100&limit=5** - -::: - -## Filtering - -:::warning - -Please make sure you've [fully URL-encoded](https://gchq.github.io/CyberChef/#recipe=URL_Encode(true)) the parameters. Do not rely on the browser's automatic URL encoding. Some characters, such as `+`, `&`, will not be automatically encoded, resulting in the final parsing result not being correct. - -::: - -:::warning - -filter supports Regex, and due to the fact that some Regex are vulnerable to DoS (ReDoS), default engine `re2` blocks some of these functionalities available in node `Regexp`. These two engines also behaves a bit different in some corner cases. [Details](https://github.com/uhop/node-re2#limitations-things-re2-does-not-support) - -If you need to use a different engine, please refer to [Deploy->Features->FILTER_REGEX_ENGINE](/install/#configuration-features). - -::: - -The following URL query parameters are supported, Regex support is built-in. - -Set `filter` to include the content - -- `filter`: filter `title` and description - -- `filter_title`: filter `title` only - -- `filter_description`: filter `description` only - -- `filter_author`: filter `author` only - -- `filter_category`: filter `category` only - -- `filter_time`: filter `pubDate`, in seconds, return specified time range. Item without `pubDate` will not be filtered. - -E.g. [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_title`: filter `title` only - -- `filterout_description`: filter `description` only - -- `filterout_author`: filter `author` only - -- `filterout_category`: filter `category` only - -E.g. [https://rsshub.app/dribbble/popular?filterout=Blue|Yellow|Black](https://rsshub.app/dribbble/popular?filterout=Blue|Yellow|Black) - -Set `filter_case_sensitive` to determine whether the filtering keywords should be case sensitive. The parameter would apply to both `filter` and `filterout`. - -Default: `true` - -E.g. [https://rsshub.app/dribbble/popular?filter=BluE|yeLLow|BlaCK&filter_case_sensitive=false](https://rsshub.app/dribbble/popular?filter=BluE|yeLLow|BlaCK&filter_case_sensitive=false) - -## Limit Entries - -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) - -## Sorted - -Set `sorted` to control whether to sort the output by the publish date (`pubDate`). This is useful for some feeds that pin some entries at the top. Default to `true` i.e. the output is sorted. - -E.g. NJU Undergraduate Bulletin Board [https://rsshub.app/nju/jw/ggtz?sorted=false](https://rsshub.app/nju/jw/ggtz?sorted=false) - -## Fulltext - -Enable fulltext via `mode` parameter. - -E.g. Bilibili article [https://rsshub.app/bilibili/user/article/334958638?mode=fulltext](https://rsshub.app/bilibili/user/article/334958638?mode=fulltext) - -## Access Control - -Set `key` or `code` to grant access to requests. See [Access Control Configuration](install/#configuration-access-control-configuration-access-key-code). - -## Telegram Instant View - -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=`) - -E.g. [https://rsshub.app/novel/biquge/94_94525?tgiv=bd3c42818a7f7e](https://rsshub.app/novel/biquge/94_94525?tgiv=bd3c42818a7f7e) - -## 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 - -E.g. [https://rsshub.app/pnas/latest?scihub=1](https://rsshub.app/pnas/latest?scihub=1) - -## 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) - -E.g. [https://rsshub.app/theinitium/channel/latest/zh-hans?opencc=t2s](https://rsshub.app/theinitium/channel/latest/zh-hans?opencc=t2s) - -## Multimedia processing - -:::warning - -This is an experimental API - -`image_hotlink_template` and `multimedia_hotlink_template` allow users to supply templates to replace media URLs. Certain routes plus certain RSS readers may result in users needing these features, but it's not very common. Vulnerable characters will be escaped automatically, making XSS attack impossible. The scope of URL replacement is limited to media elements, making any script URL unable to load and unable to cause XSS. As a result, users can only take the control of "where are the media from". These features are commonly side-effect-free. To enable these two parameters, please set `ALLOW_USER_HOTLINK_TEMPLATE` to `true` - -::: - -- `image_hotlink_template`: replace image URL in the description to avoid anti-hotlink protection, leave it blank to disable this function. Usage reference [#2769](https://github.com/DIYgod/RSSHub/issues/2769). You may use any property listed in [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL#Properties) (suffixing with `_ue` results in URL encoding), format of JS template literal. e.g. `${protocol}//${host}${pathname}`, `https://i3.wp.com/${host}${pathname}`, `https://images.weserv.nl?url=${href_ue}` -- `multimedia_hotlink_template`: the same as `image_hotlink_template` but apply to audio and video. Note: the service must follow redirects, allow reverse-proxy for audio and video, and must drop the `Referer` header when reverse-proxying. [Here is an easy-to-deploy project that fits these requirements](https://github.com/Rongronggg9/rsstt-img-relay). The project accepts simple URL concatenation, e.g. `https://example.com/${href}`, in which `example.com` should be replaced with the domain name of the service you've deployed -- `wrap_multimedia_in_iframe`: wrap audio and video in `