diff --git a/docs/en/install/README.md b/docs/en/install/README.md index b61260062..4b97f5e1b 100644 --- a/docs/en/install/README.md +++ b/docs/en/install/README.md @@ -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. diff --git a/docs/install/README.md b/docs/install/README.md index a8c59fa91..b2df770d4 100644 --- a/docs/install/README.md +++ b/docs/install/README.md @@ -603,6 +603,7 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行 - `IG_USERNAME`: Instagram 用户名。 - `IG_PASSWORD`: Instagram 密码。 + - `IG_PROXY`: Instagram 代理URL。 注意,暂不支持两步验证。 diff --git a/lib/routes/instagram/index.js b/lib/routes/instagram/index.js index 4aafe4a71..504a1f611 100644 --- a/lib/routes/instagram/index.js +++ b/lib/routes/instagram/index.js @@ -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; } }