mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-04 02:58:08 +08:00
feat: move encodeURIComponent to routes
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const query = `${params.toString()}&${advance}`;
|
||||
const res = await got.get(link, {
|
||||
query: query,
|
||||
query: query.replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str)),
|
||||
});
|
||||
const $list = cheerio.load(res.data);
|
||||
|
||||
|
||||
@@ -38,15 +38,6 @@ const custom = got.extend({
|
||||
options.query = options.query || queryString.stringify(options.params);
|
||||
}
|
||||
if (options.query) {
|
||||
if (typeof options.query === 'string') {
|
||||
options.query = options.query.replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str));
|
||||
} else if (typeof options.query === 'object') {
|
||||
for (const key in options.query) {
|
||||
if (typeof options.query[key] === 'string') {
|
||||
options.query[key] = options.query[key].replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
options.searchParams = options.query; // for Got v11 after
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user