|
@@ -256,18 +256,18 @@ class default_1 {
|
|
return utils_1.chainPromises(utils_1.Arr.chunk(userIdCache, 20).map(userIds => () => {
|
|
return utils_1.chainPromises(utils_1.Arr.chunk(userIdCache, 20).map(userIds => () => {
|
|
logger.info(`pulling stories from users:${userIds.map(id => ` @${this.cache[id].user.username}`)}`);
|
|
logger.info(`pulling stories from users:${userIds.map(id => ` @${this.cache[id].user.username}`)}`);
|
|
return this.client.feed.reelsMedia({ userIds }).request()
|
|
return this.client.feed.reelsMedia({ userIds }).request()
|
|
- .then(({ reels }) => utils_1.chainPromises(Object.keys(reels).map(userId => this.cache[userId]).map(cacheItem => () => this.queryUserObject(cacheItem.user.username)
|
|
|
|
|
|
+ .then(({ reels }) => utils_1.chainPromises(Object.keys(reels).map(userId => this.cache[userId]).map(({ user, stories }) => () => this.queryUserObject(user.username)
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
if (error instanceof instagram_private_api_1.IgExactUserNotFoundError) {
|
|
if (error instanceof instagram_private_api_1.IgExactUserNotFoundError) {
|
|
- return this.client.user.info(cacheItem.user.pk)
|
|
|
|
|
|
+ return this.client.user.info(user.pk)
|
|
.then(({ username, full_name }) => {
|
|
.then(({ username, full_name }) => {
|
|
- cacheItem.user.username = username;
|
|
|
|
- cacheItem.user.full_name = full_name;
|
|
|
|
|
|
+ user.username = username;
|
|
|
|
+ user.full_name = full_name;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- }).finally(() => Promise.all(reels[cacheItem.user.pk].items
|
|
|
|
- .filter(item => !(item.pk in cacheItem.stories))
|
|
|
|
- .map(item => this.webshot([Object.assign(Object.assign({}, item), { user: cacheItem.user })], (msgs, text, author) => cacheItem.stories[item.pk] = { pk: item.pk, msgs, text, author, original: item }, this.webshotDelay)))))))
|
|
|
|
|
|
+ }).finally(() => Promise.all(reels[user.pk].items
|
|
|
|
+ .filter(item => !(item.pk in stories))
|
|
|
|
+ .map(item => this.webshot([Object.assign(Object.assign({}, item), { user })], (msgs, text, author) => stories[item.pk] = { pk: item.pk, msgs, text, author, original: item }, this.webshotDelay)))))))
|
|
.finally(() => {
|
|
.finally(() => {
|
|
fs.writeFileSync(path.resolve(this.cachefile), JSON.stringify(this.cache));
|
|
fs.writeFileSync(path.resolve(this.cachefile), JSON.stringify(this.cache));
|
|
Object.values(this.lock.threads).forEach(thread => {
|
|
Object.values(this.lock.threads).forEach(thread => {
|