getAllTasksFromCybersport = async () => {
const response = await axios.get(Variables.cybersportNewsLineLink);
const data = response.data.data.map((item) => {
return {
'_id': item.id,
'title': item.attributes.title,
'publishedAt': item.attributes.publishedAt,
'slug': item.attributes.slug,
'image': item.attributes.image,
'text': this.getTextDataFromCybersport(item.id)
}
});
await dbNews.saveData(data, (err) => {
if (err.code === 11000) {
return;
}
console.error(err);
throw err;
});
return data
}
getTextDataFromCybersport = async (newsId) => {
const news = await axios.get(Variables.cybersportOneNewsLink + newsId);
const text = news.data.data.attributes.content.blocks.map(item => {
if (item.data.text) {
return Utils.clearHtmlTags(item.data.text)
}
})
console.log(text)
}