aooiuu / any-reader

📘开源的多平台自定义源资源聚合工具。支持小说、漫画阅读、视频播放、聚合搜索、分类排行等, 也支持本地资源TXT、EPUB

Home Page:https://aooiuu.github.io/any-reader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

增加自定义header头

dxkrs opened this issue · comments

规则中有userAgent字段,但不生效,查看源码原来是固定值。。。(那Cookie字段也是预设?)
建议可以自定义header头请求,现很多网站都有防御,最好能让请求尽可能地模仿模拟器请求。

https://aooiuu.github.io/any-reader/rule/#url-%E8%A7%84%E5%88%99

Cookie 字段目前我还没有支持

header 其实有两种方案去支持:

  1. JS: @js:(() => { return {url, method, body, encoding, headers}; })();
  2. JSON: {"url":"https://xxx.com/search","method":"post","headers":{"token":"111"},"body":{"keyword":"$keyword"}}

比如:

{
  "searchUrl":  "@js:(() => { return {url, method, body, encoding, headers}; })();"
}

这部分没有经过严格测试,如果和预期运行结果不一致,可以提bug


对于适配 eso 规则的 userAgent、Cookie 等字段,后续会根据优先级继续开发支持