mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
* fix(route): 修复 米游社 公告栏 template 错误 * feat(route): 新增 bing 搜索 * docs: Update other.mdx * docs: fix docs * feat(route): 新增 百度搜索 * fix(route): 修复 pubDate 解析错误 * fix(route): 优化 百度搜索的缓存,减轻反爬问题 * feat(route): 新增 360 搜索 * feat(route): 迁移 搜狗特色LOGO 到 v2 规范;添加 搜狗搜索 * fix(route): 百度搜索增加图片 * feat(route): 新增 Google Search * fix(route): 修复 百度搜索相关问题 * fix(route): 修复 Google 相关问题 * fix(route): 修复 360 搜索 * fix(route): 修复 搜狗搜索 * fix(route): 修复 await 问题 * fix: 移除 google sites * fix(route): 修复 缓存和过滤逻辑问题 * fix(route): 修复 360 搜索缺少 cookie 的问题 * fix(route): 修复 360 搜索 cookie 的问题 * feat(route): 移除 so.com 路由 * fix: merge conflict ---------
29 lines
943 B
JavaScript
29 lines
943 B
JavaScript
const parser = require('@/utils/rss-parser');
|
|
const { parseDate } = require('@/utils/parse-date');
|
|
const dayjs = require('dayjs');
|
|
const localizedFormat = require('dayjs/plugin/localizedFormat');
|
|
require('dayjs/locale/zh-cn');
|
|
dayjs.extend(localizedFormat);
|
|
|
|
module.exports = async (ctx) => {
|
|
const q = ctx.params.keyword;
|
|
const searchParams = new URLSearchParams({
|
|
format: 'rss',
|
|
q,
|
|
});
|
|
const url = new URL('https://cn.bing.com/search');
|
|
url.search = searchParams.toString();
|
|
const data = await parser.parseURL(url.toString());
|
|
ctx.state.data = {
|
|
title: data.title,
|
|
link: data.link,
|
|
description: data.description + ' - ' + data.copyright,
|
|
image: data.image.url,
|
|
item: data.items.map((e) => ({
|
|
...e,
|
|
description: e.content,
|
|
pubDate: parseDate(e.pubDate, 'dddd, DD MMM YYYY HH:mm:ss [GMT]', 'zh-cn'),
|
|
})),
|
|
};
|
|
};
|