fix: DeepScan issues
This commit is contained in:
parent
5ab1575a68
commit
90e1f80e78
|
|
@ -23,7 +23,6 @@ module.exports = async (ctx) => {
|
|||
description: `${userName} 的 bilibili 收藏夹 ${favName}`,
|
||||
|
||||
item:
|
||||
data &&
|
||||
data.medias &&
|
||||
data.medias.map((item) => ({
|
||||
title: item.title,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
const { data } = response.data;
|
||||
const username = data && data[0] && data[0].author_user_info && data[0].author_user_info.user_name;
|
||||
const username = data[0] && data[0].author_user_info && data[0].author_user_info.user_name;
|
||||
const resultItems = await util.ProcessFeed(data, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
const data = response.data.d.entrylist;
|
||||
const username = data && data[0] && data[0].user && data[0].user.username;
|
||||
const username = data[0] && data[0].user && data[0].user.username;
|
||||
const resultItems = await util.ProcessFeed(data, ctx.cache);
|
||||
|
||||
ctx.state.data = {
|
||||
|
|
|
|||
|
|
@ -18,30 +18,28 @@ module.exports = async (ctx) => {
|
|||
title: `${data[0].author.username} 的 Keep 动态`,
|
||||
link: `https://show.gotokeep.com/users/${id}`,
|
||||
language: 'zh-cn',
|
||||
item:
|
||||
data &&
|
||||
data.map((item) => {
|
||||
let images = [];
|
||||
if (item.images) {
|
||||
images = item.meta.picture ? item.images.concat(item.meta.picture) : item.images;
|
||||
} else if (item.meta.picture) {
|
||||
images = [item.meta.picture];
|
||||
}
|
||||
let imagesTpl = '';
|
||||
images.forEach((item) => {
|
||||
imagesTpl += `<img src="${item}">`;
|
||||
});
|
||||
item: data.map((item) => {
|
||||
let images = [];
|
||||
if (item.images) {
|
||||
images = item.meta.picture ? item.images.concat(item.meta.picture) : item.images;
|
||||
} else if (item.meta.picture) {
|
||||
images = [item.meta.picture];
|
||||
}
|
||||
let imagesTpl = '';
|
||||
images.forEach((item) => {
|
||||
imagesTpl += `<img src="${item}">`;
|
||||
});
|
||||
|
||||
const minute = Math.floor(item.meta.secondDuration / 60);
|
||||
const second = item.meta.secondDuration - minute * 60;
|
||||
return {
|
||||
title: item.meta.title.trim(),
|
||||
pubDate: item.created,
|
||||
link: `https://show.gotokeep.com/entries/${item.id}`,
|
||||
description: `项目:${item.meta.name === item.meta.workoutName ? item.meta.name : `${item.meta.name} - ${item.meta.workoutName}`}<br>时长:${minute}分${second}秒${item.content ? `<br>备注:${item.content}` : ''}${
|
||||
imagesTpl ? `<br>${imagesTpl}` : ''
|
||||
}`,
|
||||
};
|
||||
}),
|
||||
const minute = Math.floor(item.meta.secondDuration / 60);
|
||||
const second = item.meta.secondDuration - minute * 60;
|
||||
return {
|
||||
title: item.meta.title.trim(),
|
||||
pubDate: item.created,
|
||||
link: `https://show.gotokeep.com/entries/${item.id}`,
|
||||
description: `项目:${item.meta.name === item.meta.workoutName ? item.meta.name : `${item.meta.name} - ${item.meta.workoutName}`}<br>时长:${minute}分${second}秒${item.content ? `<br>备注:${item.content}` : ''}${
|
||||
imagesTpl ? `<br>${imagesTpl}` : ''
|
||||
}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
},
|
||||
});
|
||||
const data = response.data.entity.records;
|
||||
const name = data && data[0].boards[0].boardName;
|
||||
const name = data[0].boards[0].boardName;
|
||||
|
||||
ctx.state.data = {
|
||||
title: name + '-小米社区',
|
||||
|
|
|
|||
|
|
@ -39,20 +39,18 @@ module.exports = async (ctx) => {
|
|||
description: 'Sketch is a design toolkit built to help you create your best work — from your earliest ideas, through to final artwork.',
|
||||
image: 'https://cdn.sketchapp.com/assets/components/block-buy/logo.png',
|
||||
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: `${item.find('h1').first().text()}`,
|
||||
description: `${item.html()}`,
|
||||
link: `https://www.sketch.com/updates/`,
|
||||
pubDate: new Date(pubdateString).toLocaleDateString(),
|
||||
guid: version,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
item: list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: `${item.find('h1').first().text()}`,
|
||||
description: `${item.html()}`,
|
||||
link: `https://www.sketch.com/updates/`,
|
||||
pubDate: new Date(pubdateString).toLocaleDateString(),
|
||||
guid: version,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
} else {
|
||||
const content = $('.update-details').html();
|
||||
|
|
|
|||
|
|
@ -20,91 +20,89 @@ module.exports = async (ctx) => {
|
|||
title: `${data[0].actor.name}的知乎动态`,
|
||||
link: `https://www.zhihu.com/people/${id}/activities`,
|
||||
description: data[0].actor.headline || data[0].actor.description,
|
||||
item:
|
||||
data &&
|
||||
data.map((item) => {
|
||||
const detail = item.target;
|
||||
let title;
|
||||
let description;
|
||||
let url;
|
||||
const images = [];
|
||||
let text = '';
|
||||
let link = '';
|
||||
let author = '';
|
||||
item: data.map((item) => {
|
||||
const detail = item.target;
|
||||
let title;
|
||||
let description;
|
||||
let url;
|
||||
const images = [];
|
||||
let text = '';
|
||||
let link = '';
|
||||
let author = '';
|
||||
|
||||
switch (item.target.type) {
|
||||
case 'answer':
|
||||
title = detail.question.title;
|
||||
author = detail.author.name;
|
||||
description = utils.ProcessImage(detail.content);
|
||||
url = `https://www.zhihu.com/question/${detail.question.id}/answer/${detail.id}`;
|
||||
break;
|
||||
case 'article':
|
||||
title = detail.title;
|
||||
author = detail.author.name;
|
||||
description = utils.ProcessImage(detail.content);
|
||||
url = `https://zhuanlan.zhihu.com/p/${detail.id}`;
|
||||
break;
|
||||
case 'pin':
|
||||
title = detail.excerpt_title;
|
||||
author = detail.author.name;
|
||||
detail.content.forEach((contentItem) => {
|
||||
if (contentItem.type === 'text') {
|
||||
text = `<p>${contentItem.own_text}</p>`;
|
||||
} else if (contentItem.type === 'image') {
|
||||
images.push(`<p><img src="${contentItem.url.replace('xl', 'r')}"/></p>`);
|
||||
} else if (contentItem.type === 'link') {
|
||||
link = `<p><a href="${contentItem.url}" target="_blank">${contentItem.title}</a></p>`;
|
||||
} else if (contentItem.type === 'video') {
|
||||
link = `<p><video
|
||||
switch (item.target.type) {
|
||||
case 'answer':
|
||||
title = detail.question.title;
|
||||
author = detail.author.name;
|
||||
description = utils.ProcessImage(detail.content);
|
||||
url = `https://www.zhihu.com/question/${detail.question.id}/answer/${detail.id}`;
|
||||
break;
|
||||
case 'article':
|
||||
title = detail.title;
|
||||
author = detail.author.name;
|
||||
description = utils.ProcessImage(detail.content);
|
||||
url = `https://zhuanlan.zhihu.com/p/${detail.id}`;
|
||||
break;
|
||||
case 'pin':
|
||||
title = detail.excerpt_title;
|
||||
author = detail.author.name;
|
||||
detail.content.forEach((contentItem) => {
|
||||
if (contentItem.type === 'text') {
|
||||
text = `<p>${contentItem.own_text}</p>`;
|
||||
} else if (contentItem.type === 'image') {
|
||||
images.push(`<p><img src="${contentItem.url.replace('xl', 'r')}"/></p>`);
|
||||
} else if (contentItem.type === 'link') {
|
||||
link = `<p><a href="${contentItem.url}" target="_blank">${contentItem.title}</a></p>`;
|
||||
} else if (contentItem.type === 'video') {
|
||||
link = `<p><video
|
||||
controls="controls"
|
||||
width="${contentItem.playlist[1].width}"
|
||||
height="${contentItem.playlist[1].height}"
|
||||
src="${contentItem.playlist[1].url}"></video></p>`;
|
||||
}
|
||||
});
|
||||
description = `${text}${link}${images.join('')}`;
|
||||
url = `https://www.zhihu.com/pin/${detail.id}`;
|
||||
break;
|
||||
case 'question':
|
||||
title = detail.title;
|
||||
author = detail.author.name;
|
||||
description = utils.ProcessImage(detail.detail);
|
||||
url = `https://www.zhihu.com/question/${detail.id}`;
|
||||
break;
|
||||
case 'collection':
|
||||
title = detail.title;
|
||||
url = `https://www.zhihu.com/collection/${detail.id}`;
|
||||
break;
|
||||
case 'column':
|
||||
title = detail.title;
|
||||
description = `<p>${detail.intro}</p><p><img src="${detail.image_url}"/></p>`;
|
||||
url = `https://zhuanlan.zhihu.com/${detail.id}`;
|
||||
break;
|
||||
case 'topic':
|
||||
title = detail.name;
|
||||
description = `<p>${detail.introduction}</p><p>话题关注者人数:${detail.followers_count}</p>`;
|
||||
url = `https://www.zhihu.com/topic/${detail.id}`;
|
||||
break;
|
||||
case 'live':
|
||||
title = detail.subject;
|
||||
description = detail.description.replace(/\n|\r/g, '<br>');
|
||||
url = `https://www.zhihu.com/lives/${detail.id}`;
|
||||
break;
|
||||
case 'roundtable':
|
||||
title = detail.name;
|
||||
description = detail.description;
|
||||
url = `https://www.zhihu.com/roundtable/${detail.id}`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
description = `${text}${link}${images.join('')}`;
|
||||
url = `https://www.zhihu.com/pin/${detail.id}`;
|
||||
break;
|
||||
case 'question':
|
||||
title = detail.title;
|
||||
author = detail.author.name;
|
||||
description = utils.ProcessImage(detail.detail);
|
||||
url = `https://www.zhihu.com/question/${detail.id}`;
|
||||
break;
|
||||
case 'collection':
|
||||
title = detail.title;
|
||||
url = `https://www.zhihu.com/collection/${detail.id}`;
|
||||
break;
|
||||
case 'column':
|
||||
title = detail.title;
|
||||
description = `<p>${detail.intro}</p><p><img src="${detail.image_url}"/></p>`;
|
||||
url = `https://zhuanlan.zhihu.com/${detail.id}`;
|
||||
break;
|
||||
case 'topic':
|
||||
title = detail.name;
|
||||
description = `<p>${detail.introduction}</p><p>话题关注者人数:${detail.followers_count}</p>`;
|
||||
url = `https://www.zhihu.com/topic/${detail.id}`;
|
||||
break;
|
||||
case 'live':
|
||||
title = detail.subject;
|
||||
description = detail.description.replace(/\n|\r/g, '<br>');
|
||||
url = `https://www.zhihu.com/lives/${detail.id}`;
|
||||
break;
|
||||
case 'roundtable':
|
||||
title = detail.name;
|
||||
description = detail.description;
|
||||
url = `https://www.zhihu.com/roundtable/${detail.id}`;
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
title: `${data[0].actor.name}${item.action_text}: ${title}`,
|
||||
author: author,
|
||||
description: description,
|
||||
pubDate: new Date(item.created_time * 1000).toUTCString(),
|
||||
link: url,
|
||||
};
|
||||
}),
|
||||
return {
|
||||
title: `${data[0].actor.name}${item.action_text}: ${title}`,
|
||||
author: author,
|
||||
description: description,
|
||||
pubDate: new Date(item.created_time * 1000).toUTCString(),
|
||||
link: url,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,14 +42,12 @@ module.exports = async (ctx) => {
|
|||
title: `${data[0].author.name}的知乎回答`,
|
||||
link: `https://www.zhihu.com/people/${id}/answers`,
|
||||
description: data[0].author.headline || data[0].author.description,
|
||||
item:
|
||||
data &&
|
||||
data.map((item) => ({
|
||||
title: item.question.title,
|
||||
description: utils.ProcessImage(item.content),
|
||||
pubDate: new Date(item.created_time * 1000).toUTCString(),
|
||||
link: `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}`,
|
||||
})),
|
||||
item: data.map((item) => ({
|
||||
title: item.question.title,
|
||||
description: utils.ProcessImage(item.content),
|
||||
pubDate: new Date(item.created_time * 1000).toUTCString(),
|
||||
link: `https://www.zhihu.com/question/${item.question.id}/answer/${item.id}`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue