mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: 新增特斯拉系统更新 (#6275)
This commit is contained in:
@@ -314,6 +314,12 @@ pageClass: routes
|
||||
|
||||
<Route author="zytomorrow" example="/pgyer/:app" path="/pgyer/kz-test" :paramsDesc="['app为下载页最后的路径']" radar="1" rssbud="1"/>
|
||||
|
||||
## 特斯拉系统更新
|
||||
|
||||
### 版本详细信息
|
||||
|
||||
<Route author="mrbruce516" example="/tesla" path="/tesla/update"/>
|
||||
|
||||
## 腾讯柠檬 Lab
|
||||
|
||||
### 柠檬精选 Mac Apps
|
||||
|
||||
@@ -3537,4 +3537,7 @@ router.get('/youdao/latest', require('./routes/youdao/latest'));
|
||||
router.get('/yinxiang/note', require('./routes/yinxiang/note'));
|
||||
router.get('/yinxiang/card/:id?', require('./routes/yinxiang/card'));
|
||||
|
||||
// 特斯拉系统更新
|
||||
router.get('/tesla', require('./routes/tesla/update'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.notateslaapp.com/zh-cn',
|
||||
headers: {
|
||||
Referer: 'https://www.notateslaapp.com/zh-cn',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('article[id]');
|
||||
|
||||
ctx.state.data = {
|
||||
title: '特斯拉系统更新',
|
||||
link: 'https://www.notateslaapp.com/zh-cn',
|
||||
description: '特斯拉系统更新 - 最新发布',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const targetDate = item
|
||||
.find('.date')
|
||||
.text()
|
||||
.replace(/[\u4e00-\u9fa5]/g, '-')
|
||||
.replace(/\s/g, '')
|
||||
.match(/(\d{4}-\d{1,2}-\d{1,2})/);
|
||||
return {
|
||||
title: item.find('.container h1').text(),
|
||||
description: item.find('.notes-container').text() + '<img src="' + item.find('img').attr('src') + '">',
|
||||
pubDate: targetDate[0],
|
||||
link: 'https://www.notateslaapp.com' + item.find('.selector-container-notes a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user