Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const axios = require('axios');
- async function getItem(id) {
- const { data } = await axios.get('https://v2.aischedul.com/api/story/highlight/' + id);
- return data.highlightFeed
- }
- async function highlight(username) {
- const { data } = await axios.get('https://v2.aischedul.com/api/story/' + username);
- const ids = data.highlight.map(async x => await getItem(x.id.split(':')[1]));
- const highlight = [];
- const asu = await Promise.all(ids)
- for (let i = 0; i < data.highlight.length; i++) {
- let title = data.highlight[i].title
- let time = data.highlight[i].timeSince
- let cover = data.highlight[i].url
- let list = asu[i]
- highlight.push({
- title,
- time,
- cover,
- list
- })
- }
- return {
- profile: data.profile,
- highlight
- };
- }
- highlight('adiraas.p')
- .then(res => {
- console.log(res.highlight[0]);
- })
- .catch(e => {
- console.log(e);
- });
Advertisement
Add Comment
Please, Sign In to add comment