instauto 9.1.8 → 9.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ![](logo.png)
2
2
 
3
+ [![Discord](https://img.shields.io/discord/986052713425027072)](https://discord.gg/Rh3KT9zyhj) [![PayPal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/mifino/usd)
4
+
3
5
  instauto is an Instagram automation/bot library written in modern, clean javascript using Google's Puppeteer. Goal is to be very easy to set up, use, and extend, and obey instagram's limits. Heavily inspired by [InstaPy](https://github.com/timgrossmann/InstaPy), but I thought it was way too heavy and hard to setup.
4
6
 
5
7
  **NEW! 🎉**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instauto",
3
- "version": "9.1.8",
3
+ "version": "9.1.9",
4
4
  "description": "Instagram automation library written in Node.js",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -881,6 +881,19 @@ const Instauto = async (db, browser, options) => {
881
881
  }
882
882
  }
883
883
 
884
+ async function tryClickLogin() {
885
+ async function tryClickButton(xpath) {
886
+ const btn = (await page.$x(xpath))[0];
887
+ if (!btn) return false;
888
+ await btn.click();
889
+ return true;
890
+ }
891
+
892
+ if (await tryClickButton("//button[.//text() = 'Log In']")) return true;
893
+ if (await tryClickButton("//button[.//text() = 'Log in']")) return true; // https://github.com/mifi/instauto/pull/110 https://github.com/mifi/instauto/issues/109
894
+ return false;
895
+ }
896
+
884
897
  await setEnglishLang(false);
885
898
 
886
899
  await tryPressButton(await page.$x('//button[contains(text(), "Accept")]'), 'Accept cookies dialog');
@@ -909,11 +922,8 @@ const Instauto = async (db, browser, options) => {
909
922
  await sleep(1000);
910
923
 
911
924
  for (;;) {
912
- const loginButton = (await page.$x("//button[.//text() = 'Log In']"))[0];
913
- if (loginButton) {
914
- await loginButton.click();
915
- break;
916
- }
925
+ const didClickLogin = await tryClickLogin();
926
+ if (didClickLogin) break;
917
927
  logger.warn('Login button not found. Maybe you can help me click it? And also report an issue on github with a screenshot of what you\'re seeing :)');
918
928
  await sleep(6000);
919
929
  }