instauto 9.1.4 → 9.1.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instauto",
3
- "version": "9.1.4",
3
+ "version": "9.1.5",
4
4
  "description": "Instagram automation library written in Node.js",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -45,6 +45,8 @@ const Instauto = async (db, browser, options) => {
45
45
  followUserMinFollowers = null,
46
46
  followUserMinFollowing = null,
47
47
 
48
+ shouldFollowUser = null,
49
+
48
50
  dontUnfollowUntilTimeElapsed = 3 * 24 * 60 * 60 * 1000,
49
51
 
50
52
  excludeUsers = [],
@@ -594,9 +596,7 @@ const Instauto = async (db, browser, options) => {
594
596
 
595
597
  const graphqlUser = await navigateToUserAndGetData(username);
596
598
 
597
- const followedByCount = graphqlUser.edge_followed_by.count;
598
- const followsCount = graphqlUser.edge_follow.count;
599
- const isPrivate = graphqlUser.is_private;
599
+ const { edge_followed_by: { count: followedByCount }, edge_follow: { count: followsCount }, is_private: isPrivate, is_verified: isVerified, is_business_account: isBusinessAccount, is_professional_account: isProfessionalAccount, full_name: fullName, biography, profile_pic_url_hd: profilePicUrlHd, external_url: externalUrl, business_category_name: businessCategoryName, category_name: categoryName } = graphqlUser;
600
600
 
601
601
  // logger.log('followedByCount:', followedByCount, 'followsCount:', followsCount);
602
602
 
@@ -622,6 +622,10 @@ const Instauto = async (db, browser, options) => {
622
622
  logger.log('User has too many followers compared to follows or opposite, skipping');
623
623
  return false;
624
624
  }
625
+ if (shouldFollowUser !== null && (typeof shouldFollowUser === 'function' && !shouldFollowUser({ username, isVerified, isBusinessAccount, isProfessionalAccount, fullName, biography, profilePicUrlHd, externalUrl, businessCategoryName, categoryName }) === true)) {
626
+ logger.log(`Custom follow logic returned false for ${username}, skipping`);
627
+ return false;
628
+ }
625
629
 
626
630
  await followUser(username);
627
631