增加自定义header头
dxkrs opened this issue · comments
RaysonLu commented
规则中有userAgent字段,但不生效,查看源码原来是固定值。。。(那Cookie字段也是预设?)
建议可以自定义header头请求,现很多网站都有防御,最好能让请求尽可能地模仿模拟器请求。
aooiuu commented
https://aooiuu.github.io/any-reader/rule/#url-%E8%A7%84%E5%88%99
Cookie
字段目前我还没有支持
header
其实有两种方案去支持:
- JS:
@js:(() => { return {url, method, body, encoding, headers}; })();
- 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 等字段,后续会根据优先级继续开发支持