|
@@ -11,7 +11,7 @@ import {
|
|
|
} from 'instagram-id-to-url-segment';
|
|
|
import {
|
|
|
IgApiClient,
|
|
|
- IgClientError, IgExactUserNotFoundError, IgLoginTwoFactorRequiredError, IgResponseError,
|
|
|
+ IgClientError, IgExactUserNotFoundError, IgLoginRequiredError, IgLoginTwoFactorRequiredError, IgResponseError,
|
|
|
MediaInfoResponseItemsItem, UserFeedResponseItemsItem
|
|
|
} from 'instagram-private-api';
|
|
|
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
@@ -472,6 +472,12 @@ export default class {
|
|
|
public queryUserMedia: (username: string, targetId?: string) => Promise<LazyMediaItem[]>;
|
|
|
|
|
|
public queryUser = (username: string) => this.client.user.searchExact(username)
|
|
|
+ .catch((error: IgClientError) => {
|
|
|
+ if (error instanceof IgLoginRequiredError) {
|
|
|
+ logger.warn('login required, logging in again...');
|
|
|
+ return this.session.login().then(() => this.client.user.searchExact(username));
|
|
|
+ } else throw error;
|
|
|
+ })
|
|
|
.then(user => `${user.username}:${user.pk}`);
|
|
|
|
|
|
private workOnMedia = (
|