Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow Users Who Liked Content Of User #85

Open
Flamintus opened this issue Mar 30, 2022 · 8 comments
Open

Follow Users Who Liked Content Of User #85

Flamintus opened this issue Mar 30, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@Flamintus
Copy link

Flamintus commented Mar 30, 2022

Based on #75 may you provide a way to list content_shortcodes from a user, so we get an input for the function getUsersWhoLikedContent({ contentId })

Awaited workflow for FollowUsersWhoLikedContentOfUser :

  • 1 getContentFromUser (Todo)
  • 2 getUsersWhoLikedContent (available thanks to @joelemanoel)
  • 3 followUsers (available thanks to @mifi)

Please notice that if I use FollowUsersWhoLikedContentFromThisUser on My account it will auto follow users who liked my posts

@Flamintus
Copy link
Author

Flamintus commented Mar 30, 2022

Indeed I'm talking here about an "enhancement" :) Because this code run perfectly! Thanks by advance 👍

@Flamintus
Copy link
Author

@joelemanoel maybe you already have something like that!? :)

@joelemanoel
Copy link
Contributor

Yeah. I will develop soon. Just find some free time and I'll do it.

@Flamintus
Copy link
Author

@joelemanoel Thank you very much by advance. I'm really enthusiast about this project, if I can help, let me know I will! Already started with the 2 first PR of my life today :))

@Flamintus
Copy link
Author

Flamintus commented Mar 31, 2022

Quick Share, for the moment, I run with that 👍

`
console.log('### PART 2 :STARTING following liker of my posts');

console.log('Searching for liker of my posts');

const myposts = ['CbuV2QhAdyN','CbwxgsyAcgc','CbtAGqjATiz','Cbs6nSTAqud','Cbs4pj8AdBb','Cbs3egsgh_K','CbsqCV6ASfj','CbsgS_LAsHn','CbdcPixvoZG','Cbv5JxtAM9'];

for await (const post of myposts) {

    const getUsersWhoLikedContent= await instauto.getUsersWhoLikedContent({ contentId: post, maxPages: 10 }); console.log(getUsersWhoLikedContent);

    for await (const userstofollow of getUsersWhoLikedContent) 
    {
        console.log('users to like ?', userstofollow)

       for await (const usertofollow of userstofollow) {

            console.log('usertolike', usertofollow)
            console.log('Following');
            await instauto.followUser(usertofollow);

        }
    }
}
console.log('DONE following liker of my posts');`

Unfortunately, I dont have enough skill in NODEJS to :

  • dynamise post list form a username
  • verify if we already follow a user before going on his profile

@metapodcod
Copy link

is there any progress on this?

@Flamintus
Copy link
Author

Flamintus commented Aug 31, 2022

I can share my actual peace of code that is working. BUT I'm pretty sure that it is a bad way to do it, @joelemanoel may you help to integrate it properly ?

    logger.info('####################################################');
    logger.info('### PART 1 :STARTING following liker of my posts ###');
    logger.info('####################################################');
    logger.info('### Searching for liker of my posts');
    const myposts = ['POSTID', 'POSTID', 'POSTID', 'POSTID'];
    logger.info('Post list : ', myposts);

    // END TODO

    // Lister mes Followers
    logger.info('### Searching for all previously folowed users');
    const allFollowing = await instauto.listManuallyFollowedUsers();
    logger.info('allFollowing', allFollowing);

    // On boucle sur les posts
    logger.info('### Starting Loop on my posts');
    for await (const post of myposts) {

        logger.info('####################################################');
        logger.info('### Searching for likers of postid ', post);
        logger.info('####################################################');
        const getUsersWhoLikedContent= await instauto.getUsersWhoLikedContent({ contentId: post, maxPages:10});  console.log(getUsersWhoLikedContent);

        // On boucle sur les flollowers du post
        for await (const userstofollow of getUsersWhoLikedContent) {

            logger.info('### Loop on Users', userstofollow)

            for await (const usertofollow of userstofollow) {

                await instauto.throttle();

                logger.info('####################################################');
                logger.info('### New USER', usertofollow);
                logger.info('####################################################');

                logger.info('[',usertofollow,']','Analysing');

                // EN COURS Si pas déja suivi
                logger.info('[',usertofollow,']','[CHECK][Recently Asked for follow] Runing');
                const allreadyaskedforfollow = await instauto.haveRecentlyFollowedUser(usertofollow);
                logger.info('[',usertofollow,']','[CHECK][Recently Asked for follow] Result', allreadyaskedforfollow);


                logger.info('[',usertofollow,']','[CHECK][Allready Folloing] Runing');
                const allreadyfollowed = allFollowing.find(allFollowing => {
                  return allFollowing === usertofollow
                })
                logger.info('[',usertofollow,']','[CHECK][Allready Folloing] Result', !!allreadyfollowed);

                if (allreadyfollowed) {
                    logger.info('[',usertofollow,']','----> SKIP (We are Allready Folloing this user)');
                }else if(allreadyaskedforfollow){
                    logger.info('[',usertofollow,']','----> SKIP (We Recently Asked this user for follow)');
                }else{
                    logger.info('[',usertofollow,']','[CONTINUE][Not folowing and not recently followed by me]');

                    // Todo Si non privé
                    logger.info('[',usertofollow,']','[CHECK][Does User Flow me] Runing');
                    const followsMe = await instauto.doesUserFollowMe(usertofollow);
                    logger.info('[',usertofollow,']','[CHECK][Does User Flow me] Result', followsMe);

                    if(followsMe != true){
                        logger.info('[FINISHED] Following user ', usertofollow);
                        logger.info('[',usertofollow,']','[FINISH][Following user] Runing');

                        await instauto.followUser(usertofollow);
                        logger.info('[FINISH][Following user] DONE', usertofollow);
                        logger.info('[',usertofollow,']','[FINISH][Following user] DONE');

                    }else{
                        logger.info('[',usertofollow,']','----> SKIP (We are allready followed by this user)');
                    }
                }
            }
        }
    }
    console.log('DONE following liker of my posts');

Also you have to edit .\node_modules\instauto\src\index.js to add this in the global return function

    doesUserFollowMe,
    navigateToUserAndGetData,
    throttle,
    haveRecentlyFollowedUser,

image

@mifi mifi added the enhancement New feature or request label Sep 27, 2022
@Flamintus
Copy link
Author

Any news about this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants