diff --git a/docs/en/faq.md b/docs/en/faq.md index 071825e4c..5766435ee 100644 --- a/docs/en/faq.md +++ b/docs/en/faq.md @@ -8,9 +8,13 @@ **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](/en/install/) to get a better usability. -**Q: Why are images not loading in some RSSHub routes?** +**Q: Why are images/videos not loading in some RSSHub routes?** -**A:** RSSHub fetches and respects the original image URLs from original sites, `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 which leads to cross-domain requests being blocked. +**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), [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](/en/parameter.html#multimedia-processing) for more details. +3. Navigate back to the original site. **Q: The website I want is not supported QAQ** diff --git a/docs/en/install/README.md b/docs/en/install/README.md index 59f9d8677..1cc75336f 100644 --- a/docs/en/install/README.md +++ b/docs/en/install/README.md @@ -523,7 +523,13 @@ See the relation between access key/code and white/blacklisting. ### Image Processing -`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), format of JS template literal. e.g. `${protocol}//${host}${pathname}`, `https://i3.wp.com/${host}${pathname}` +::: warning Deprecation warning + +The options below are deprecated, preserved only for backward compatibility, please refer to [Parameters->Multimedia processing](/en/parameter.html#multimedia-processing) for more details. + +::: + +`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 @@ -539,6 +545,16 @@ 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](/en/parameter.html#multimedia-processing) + ### Other Application Configurations `DISALLOW_ROBOT`: prevent indexing by search engine, default to enable, set false or 0 to disable diff --git a/docs/en/parameter.md b/docs/en/parameter.md index 6cedcbd28..edccba058 100644 --- a/docs/en/parameter.md +++ b/docs/en/parameter.md @@ -88,6 +88,22 @@ E.g. E.g. +## Multimedia processing + +::: warning 注意 + +This is an experimental API + +The following operation allows user to inject codes, which is harmful in web environment. However, RSS feed reader usually limits these functions. While normally routes won't need these functions, please set `ALLOW_USER_HOTLINK_TEMPLATE` to `true` if you understand how these parameters works. + +::: + +- `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 ` diff --git a/lib/v2/test/index.js b/lib/v2/test/index.js index 5535264a0..196ef1fe3 100644 --- a/lib/v2/test/index.js +++ b/lib/v2/test/index.js @@ -103,7 +103,7 @@ module.exports = async (ctx) => { title: `Multimedia Title`, description: ` -