diff --git a/docs/new-media.md b/docs/new-media.md
index 877e6a1ac..708bfbb55 100644
--- a/docs/new-media.md
+++ b/docs/new-media.md
@@ -891,18 +891,6 @@ IPFS 网关有可能失效,那时候换成其他网关。
-## 迈凯伦赛车
-
-### 文章
-
-
-
-| 所有媒体 | 文章 | 报道 | 图库 | 视频 | 博客 | 图文 (Photo Essay) |
-| -------- | ---- | ---- | ---- | ---- | ---- | ------------------ |
-| all | article | report | gallery | video | blog | photo\_essay |
-
-
-
## Mirror
### User
@@ -3027,6 +3015,18 @@ column 为 third 时可选的 category:
+## 迈凯伦赛车
+
+### 文章
+
+
+
+| 所有媒体 | 文章 | 报道 | 图库 | 视频 | 博客 | 图文 (Photo Essay) |
+| ---- | ------- | ------ | ------- | ----- | ---- | ---------------- |
+| all | article | report | gallery | video | blog | photo_essay |
+
+
+
## 慢雾科技
### 动态
diff --git a/lib/v2/mclaren/index.js b/lib/v2/mclaren/index.js
index 887401e2c..9f3599450 100644
--- a/lib/v2/mclaren/index.js
+++ b/lib/v2/mclaren/index.js
@@ -4,92 +4,93 @@ const path = require('path');
const { art } = require('@/utils/render');
module.exports = async (ctx) => {
- let baseUrl, apiUrl;
- let title, description;
- let lang = ctx.params.lang;
- switch (lang) {
- case 'en':
- baseUrl = 'https://www.mclaren.com';
- title = 'McLaren Racing – Official Website';
- description = 'Latest news and insight from McLaren Racing. Team and driver updates, videos and McLaren Formula 1 LIVE commentary.';
- lang = 'en-UK';
- break;
- case 'zh':
- baseUrl = 'https://cn.mclaren.com';
- title = '迈凯伦赛车 — 官方网站';
- description = '来自迈凯伦一级方程式车队的最新消息。 查看车队和车手近况、视频以及比赛中的迈凯伦实况评论和实时数据。';
- lang = 'zh-CN';
- break;
- case 'es':
- baseUrl = 'https://es.mclaren.com';
- title = 'McLaren Racing - Sitio web oficial';
- description = 'Consulta las últimas noticias del equipo de Fórmula 1 McLaren. Incluye información sobre el equipo, las últimas actualizaciones de los pilotos y McLaren LIVE, una aplicación con la que podrás seguir los comentarios en directo.';
- lang = 'es-ES';
- break;
- default:
- throw Error(`Language '${lang}' is not supported.`);
- };
+ let baseUrl, apiUrl;
+ let title, description;
+ let lang = ctx.params.lang;
+ switch (lang) {
+ case 'en':
+ baseUrl = 'https://www.mclaren.com';
+ title = 'McLaren Racing – Official Website';
+ description = 'Latest news and insight from McLaren Racing. Team and driver updates, videos and McLaren Formula 1 LIVE commentary.';
+ lang = 'en-UK';
+ break;
+ case 'zh':
+ baseUrl = 'https://cn.mclaren.com';
+ title = '迈凯伦赛车 — 官方网站';
+ description = '来自迈凯伦一级方程式车队的最新消息。 查看车队和车手近况、视频以及比赛中的迈凯伦实况评论和实时数据。';
+ lang = 'zh-CN';
+ break;
+ case 'es':
+ baseUrl = 'https://es.mclaren.com';
+ title = 'McLaren Racing - Sitio web oficial';
+ description =
+ 'Consulta las últimas noticias del equipo de Fórmula 1 McLaren. Incluye información sobre el equipo, las últimas actualizaciones de los pilotos y McLaren LIVE, una aplicación con la que podrás seguir los comentarios en directo.';
+ lang = 'es-ES';
+ break;
+ default:
+ throw Error(`Language '${lang}' is not supported.`);
+ }
- const { category = 'all' } = ctx.params;
- const categoryArr = ['all', 'article', 'report', 'gallery', 'video', 'blog', 'photo_essay'];
- if (!categoryArr.includes(category)) {
- throw Error(`Category '${category}' is not supported.`);
- };
+ const { category = 'all' } = ctx.params;
+ const categoryArr = ['all', 'article', 'report', 'gallery', 'video', 'blog', 'photo_essay'];
+ if (!categoryArr.includes(category)) {
+ throw Error(`Category '${category}' is not supported.`);
+ }
- const link = baseUrl + '/racing/articles/';
- apiUrl = baseUrl + '/racing/api/grid-search/?count=30&offset=0&type=';
- // count: number of requested entries; default to 16, up to 30.
- // offset: default to 0.
- if (category !== 'all') {
- apiUrl += category;
- }
+ const link = baseUrl + '/racing/articles/';
+ apiUrl = baseUrl + '/racing/api/grid-search/?count=30&offset=0&type=';
+ // count: number of requested entries; default to 16, up to 30.
+ // offset: default to 0.
+ if (category !== 'all') {
+ apiUrl += category;
+ }
- const response = await got(apiUrl);
+ const response = await got(apiUrl);
- const html = response.data.html;
- const $ = cheerio.load(html);
- const list = $('li')
- .toArray()
- .map((item) => {
- item = $(item);
- const thumbnailUrl = item.find('div.start-grid-content__img').attr('style').slice(22, -2);
- return {
- link: baseUrl + item.find('a.start-grid-content__link').attr('href'),
- thumbnailUrl, // Pass the thumbnail image
- };
- });
+ const html = response.data.html;
+ const $ = cheerio.load(html);
+ const list = $('li')
+ .toArray()
+ .map((item) => {
+ item = $(item);
+ const thumbnailUrl = item.find('div.start-grid-content__img').attr('style').slice(22, -2);
+ return {
+ link: baseUrl + item.find('a.start-grid-content__link').attr('href'),
+ thumbnailUrl, // Pass the thumbnail image
+ };
+ });
- const items = await Promise.all(
- list.map((item) =>
- ctx.cache.tryGet(item.link, async () => {
- const itemRep = await got(item.link);
- const $ = cheerio.load(itemRep.data);
- $('.livestream--wrapper').last().remove();
- item.title = $('meta[property="og:title"]').attr('content').slice(17);
- item.pubDate = Date.parse($('time[datetime]').first().attr('datetime'));
- const artParams = {
- desc: $('meta[property="og:description"]').attr('content'),
- heroUrl: $('meta[property="og:image"]').attr('content'),
- videoId: $('a[data-video-id]').attr('data-video-id'),
- };
- $('.meta--hold, .show-for-small').remove();
- artParams.content = $('div.article-body').html();
- item.description = art(path.join(__dirname, 'templates/desc.art'), artParams);
- item.media = {
- thumbnail: {
- url: item.thumbnailUrl,
- },
- };
- return item;
- })
- )
- );
+ const items = await Promise.all(
+ list.map((item) =>
+ ctx.cache.tryGet(item.link, async () => {
+ const itemRep = await got(item.link);
+ const $ = cheerio.load(itemRep.data);
+ $('.livestream--wrapper').last().remove();
+ item.title = $('meta[property="og:title"]').attr('content').slice(17);
+ item.pubDate = Date.parse($('time[datetime]').first().attr('datetime'));
+ const artParams = {
+ desc: $('meta[property="og:description"]').attr('content'),
+ heroUrl: $('meta[property="og:image"]').attr('content'),
+ videoId: $('a[data-video-id]').attr('data-video-id'),
+ };
+ $('.meta--hold, .show-for-small').remove();
+ artParams.content = $('div.article-body').html();
+ item.description = art(path.join(__dirname, 'templates/desc.art'), artParams);
+ item.media = {
+ thumbnail: {
+ url: item.thumbnailUrl,
+ },
+ };
+ return item;
+ })
+ )
+ );
- ctx.state.data = {
- language: lang,
- title,
- description,
- link,
- item: items,
- };
+ ctx.state.data = {
+ language: lang,
+ title,
+ description,
+ link,
+ item: items,
+ };
};
diff --git a/lib/v2/mclaren/radar.js b/lib/v2/mclaren/radar.js
index df373124d..a2f1f58bd 100644
--- a/lib/v2/mclaren/radar.js
+++ b/lib/v2/mclaren/radar.js
@@ -1,25 +1,28 @@
module.exports = {
'mclaren.com': {
_name: 'Mclaren Racing',
- www: [{
- title: 'Mclaren Racing',
- docs: 'https://docs.rsshub.app/new-media.html#mai-kai-lun-sai-che',
- source: '/racing/articles/',
- target: '/mclaren/en/all'
+ www: [
+ {
+ title: 'Mclaren Racing',
+ docs: 'https://docs.rsshub.app/new-media.html#mai-kai-lun-sai-che',
+ source: '/racing/articles/',
+ target: '/mclaren/en/all',
},
],
- cn: [{
- title: '迈凯伦赛车',
- docs: 'https://docs.rsshub.app/new-media.html#mai-kai-lun-sai-che',
- source: '/racing/articles/',
- target: '/mclaren/zh/all'
+ cn: [
+ {
+ title: '迈凯伦赛车',
+ docs: 'https://docs.rsshub.app/new-media.html#mai-kai-lun-sai-che',
+ source: '/racing/articles/',
+ target: '/mclaren/zh/all',
},
],
- es: [{
- title: 'Mclaren Racing',
- docs: 'https://docs.rsshub.app/new-media.html#mai-kai-lun-sai-che',
- source: '/racing/articles/',
- target: '/mclaren/es/all'
+ es: [
+ {
+ title: 'Mclaren Racing',
+ docs: 'https://docs.rsshub.app/new-media.html#mai-kai-lun-sai-che',
+ source: '/racing/articles/',
+ target: '/mclaren/es/all',
},
],
},