mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
refactor: format
This commit is contained in:
@@ -22,11 +22,9 @@ module.exports = async (ctx) => {
|
||||
function getData(jscontent, option) {
|
||||
switch (option) {
|
||||
case 'date': {
|
||||
// eslint-disable-next-line
|
||||
let jsoutput = String(jscontent)
|
||||
const jsoutput = String(jscontent)
|
||||
.substr(-23, 10)
|
||||
// eslint-disable-next-line
|
||||
.replace(/\_/g, '-');
|
||||
.replace(/_/g, '-');
|
||||
return new Date(jsoutput).toLocaleDateString();
|
||||
}
|
||||
case 'urlid': {
|
||||
@@ -34,7 +32,6 @@ module.exports = async (ctx) => {
|
||||
return jsoutput;
|
||||
}
|
||||
default: {
|
||||
// console.log('default');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -42,6 +39,7 @@ module.exports = async (ctx) => {
|
||||
// 循环获取ptype每个请求的数据内容
|
||||
for (const key in ptype) {
|
||||
const link = ptype[key].url;
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: link,
|
||||
@@ -213,9 +211,6 @@ module.exports = async (ctx) => {
|
||||
HomeFeeds.push(temp[i][k]);
|
||||
}
|
||||
}
|
||||
// 检查数据获取条数
|
||||
// console.log(temp[0][3]);
|
||||
console.log('HomeFeeds数组长度:' + HomeFeeds.length, '头条:' + temp[0].length, '左1列:' + temp[1].length, '中右2列:' + temp[2].length, '访谈、论坛' + temp[3].length, '历史、深度' + temp[4].length);
|
||||
break;
|
||||
case 'redian':
|
||||
list[1] = response.data.items;
|
||||
@@ -236,9 +231,6 @@ module.exports = async (ctx) => {
|
||||
RedianFeeds.push(temp[i][k]);
|
||||
}
|
||||
}
|
||||
// 检查数据获取条数
|
||||
// console.log(RedianFeeds);
|
||||
console.log('RedianFeeds数组长度:' + RedianFeeds.length, '热点:' + temp[0].length);
|
||||
break;
|
||||
case 'member':
|
||||
list[2] = response.data.items;
|
||||
@@ -260,9 +252,6 @@ module.exports = async (ctx) => {
|
||||
MemberFeeds.push(temp[i][k]);
|
||||
}
|
||||
}
|
||||
// 检查数据获取条数
|
||||
// console.log(MemberFeeds);
|
||||
console.log('MemberFeeds数组长度:' + MemberFeeds.length, '观察员:' + temp[0].length);
|
||||
break;
|
||||
case 'gundong':
|
||||
list[3] = response.data.fenghot;
|
||||
@@ -303,9 +292,6 @@ module.exports = async (ctx) => {
|
||||
GundongFeeds.push(temp[i][k]);
|
||||
}
|
||||
}
|
||||
// 检查数据获取条数
|
||||
// console.log(GundongFeeds);
|
||||
console.log('GundongFeeds数组长度:' + GundongFeeds.length, '滚动新闻:' + temp[0].length, '风闻7天最热:' + temp[1].length, '观察员付费:' + temp[2].length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user