Added support for various tube and social media sites via youtube-dl.
This commit is contained in:
@@ -42,6 +42,11 @@ const getPostsWrap = reddit => function getPosts(postIds, userPosts = {}) {
|
||||
name: '[deleted]',
|
||||
deleted: true,
|
||||
posts: [post],
|
||||
indexed: {
|
||||
profile: {},
|
||||
original: [],
|
||||
updated: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -50,26 +50,57 @@ async function getArchivedPosts(username, posts, reddit) {
|
||||
|
||||
function getUserPostsWrap(reddit, args) {
|
||||
return async function getUserPosts(usernames) {
|
||||
const users = await Promise.map(usernames, async (username) => {
|
||||
const [user, posts] = await Promise.all([
|
||||
getUser(username, reddit),
|
||||
getPosts(username, reddit, args),
|
||||
]);
|
||||
try {
|
||||
const users = await Promise.map(usernames, async (username) => {
|
||||
try {
|
||||
const [user, posts] = await Promise.all([
|
||||
getUser(username, reddit),
|
||||
getPosts(username, reddit, args),
|
||||
]);
|
||||
|
||||
const { profile, posts: indexed } = await getIndex(user);
|
||||
const { profile, posts: indexed } = await getIndex(user);
|
||||
|
||||
if (args.archives) {
|
||||
posts.push(...await getArchivedPosts(username, posts, reddit));
|
||||
}
|
||||
if (args.archives) {
|
||||
posts.push(...await getArchivedPosts(username, posts, reddit));
|
||||
}
|
||||
|
||||
if (posts.length) {
|
||||
return { ...user, posts, indexed: { profile, original: indexed, updated: [] } };
|
||||
}
|
||||
if (posts.length) {
|
||||
return {
|
||||
...user,
|
||||
posts,
|
||||
indexed: {
|
||||
profile,
|
||||
original: indexed,
|
||||
updated: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
return null;
|
||||
} catch (error) {
|
||||
console.log(username, error);
|
||||
|
||||
return users.reduce((userPosts, user) => (user ? { ...userPosts, [user.name]: user } : userPosts), {});
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
concurrency: 5,
|
||||
});
|
||||
|
||||
return users.reduce(
|
||||
(userPosts, user) => (user
|
||||
? {
|
||||
...userPosts,
|
||||
[user.name]: user,
|
||||
}
|
||||
: userPosts
|
||||
),
|
||||
{},
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user