Merge pull request #6659 from lifegpc/patch1
[Instagram]增加代理设置,修改抛出错误的方式
This commit is contained in:
commit
e997e86340
|
|
@ -494,6 +494,7 @@ See docs of specified route and `lib/config.js` for detail information.
|
|||
|
||||
- `IG_USERNAME`: Your Instagram username
|
||||
- `IG_PASSWORD`: Your Instagram password
|
||||
- `IG_PROXY`: Proxy URL for Instagram
|
||||
|
||||
Warning: Two Factor Authentication is *not* supported.
|
||||
|
||||
|
|
|
|||
|
|
@ -603,6 +603,7 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
|
|||
|
||||
- `IG_USERNAME`: Instagram 用户名。
|
||||
- `IG_PASSWORD`: Instagram 密码。
|
||||
- `IG_PROXY`: Instagram 代理URL。
|
||||
|
||||
注意,暂不支持两步验证。
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,17 @@ module.exports = async (ctx) => {
|
|||
throw Error('Such feed is not supported.');
|
||||
}
|
||||
|
||||
if (process.env.IG_PROXY) {
|
||||
ig.state.proxyUrl = process.env.IG_PROXY;
|
||||
}
|
||||
|
||||
try {
|
||||
await ig.account.currentUser();
|
||||
} catch (e) {
|
||||
if (e instanceof IgLoginRequiredError) {
|
||||
await login(ig);
|
||||
} else {
|
||||
throw Error('Unknown error');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue