HARPA.AI
LIBRARYUSE CASESGUIDESAI COMMANDSBLOG

๐Ÿ”„ย ย Instagram Auto Follow or Unfollow v1.1

Auto follow or unfollow a list of accounts on Instagram. Requires a list of @usernames or Instagram profile links. #instagram

Created by Bohdan Kovtunenko
Updated on Dec 20, 11:57
Installed 41 times
RUNS JS CODE

How to Use

IMPORT COMMAND

Content

- label: ASK FOR USERS
  type: ask
  param: input
  message: |-
    Send me a list of profiles either as:

    1. @usernames separated by commas, e.g.:

    ```
    @harpa.ai,  @chrome, @extension
    ```

    2. JSON with URLs, e.g.:

    ```json
    [
    {
      "url": "https://www.instagram.com/harpa.ai/"
    },
    {
      "url": "https://www.instagram.com/username/"
    }
    ]
    ```
  options: null
  default: ''
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
- label: EXTRACT USERNAMES
  type: group
  steps:
    - type: js
      code: |-
        function extractUsernames(input) {
            let usernames = [];

            // Convert input to string
            const inputStr = String(input);

            // Unified regex to extract @mentions and Instagram URLs
            const usernameRegex = /@(\w+(\.\w+)*(\_\w+)*(\.\w+)*)|https:\/\/www\.instagram\.com\/([\w\.]+)/g;
            let matches;

            // Search through the string input for usernames and URLs
            while ((matches = usernameRegex.exec(inputStr)) !== null) {
                // Push the non-null match group, either mention or URL segment
                usernames.push(matches[1] || matches[5]);
            }

            return usernames;
        }

        // Using the function, assuming input is already defined
        return extractUsernames(input);
      args: input
      param: list
      timeout: 15000
      silent: true
- condition: '{{list.length}} = 0'
  label: FAIL
  type: group
  steps:
    - type: say
      message: โ›”๏ธ Unrecognised @username or URL format.
    - type: jump
      to: ASK FOR USERS
- label: ASK ACTION
  type: ask
  param: action
  message: '{{list.length}} usenames extracted.'
  options:
    - label: โœ… FOLLOW ALL
      value: follow
    - label: โŽ UNFOLLOW
      value: unfollow
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  default: ''
  optionsInvalid: false
- label: ASK SPEED
  type: ask
  param: delay
  message: >-
    ๐Ÿ’ก Choose an option or enter a custom delay in milliseconds (1 min = 60 sec
    = 60000 ms).
  options:
    - label: โฉ NORMAL (30 sec.)
      value: 30000
    - label: โ–ถ๏ธ SLOW (5 min.)
      value: 300000
    - label: โญ FAST (10 sec.)
      value: 10000
    - $custom
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  default: ''
  optionsInvalid: false
- type: loop
  list: list
  steps:
    - type: calc
      func: clone
      from: item
      to: username
    - label: NAVIGATE
      type: group
      steps:
        - type: say
          message: >-
            ๐ŸŒ Navigating to
            **[@{{username}}](https://www.instagram.com/{{username}}/)**'s
            profile.
        - type: navigate
          url: https://www.instagram.com/{{username}}/
          waitForIdle: false
          silent: true
        - type: wait
          for: 2s
          silent: true
    - condition: '{{action}} = follow'
      label: FOLLOW
      type: group
      steps:
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $class: _acan
                - $class: _acap
                - $class: _acas
                - $class: _aj1-
                - $class: _ap30
                - $attribute: type=button
                - $style: '-apple-system:14px:600:normal'
                - $content: Follow
                - $class: x150jy0e
                  traverse: '-1'
                - $class: x1e558r4
                  traverse: '-1'
                - $class: xxz05av
                  traverse: '1:0:0:0'
                - $class: xkfe5hh
                  traverse: '1:0:0:0'
                - $class: xg1prrt
                  traverse: '0:1:0:0:0'
                - $anchor: TAGGED
                  shift: 23:-184
              min: 6
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 0
            value: Follow
          silent: true
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $class: _acan
                - $class: _acap
                - $class: _acas
                - $class: _aj1-
                - $class: _ap30
                - $attribute: type=button
                - $style: '-apple-system:14px:600:normal'
                - $content: Follow Back
                - $class: xxz05av
                  traverse: '1:0:0:0'
                - $class: xkfe5hh
                  traverse: '1:0:0:0'
                - $class: xg1prrt
                  traverse: '0:1:0:0:0'
                - $class: x1quol0o
                  traverse: '0:1:0:0:0'
                - $anchor: This account is private
                  shift: 148:-208
                - $text: This account is private
                  traverse: '-7:0:1:0:1:0:0:0'
              min: 10
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 1
            value: Follow Back
          silent: true
        - type: wait
          for: 1s
          silent: true
        - type: say
          message: >-
            **[@{{username}}](https://www.instagram.com/{{username}}/)**
            followed! 
    - condition: '{{action}} = unfollow'
      label: UNFOLLOW
      type: group
      steps:
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: BUTTON
                - $role: button
                - $class: _acan
                - $class: _acap
                - $class: _acat
                - $class: _aj1-
                - $class: _ap30
                - $attribute: type=button
                - $style: '-apple-system:14px:600:normal'
                - $content: Following
                - $class: x150jy0e
                  traverse: '-1'
                - $class: x1e558r4
                  traverse: '-1'
                - $class: xxz05av
                  traverse: '1:0:0:0'
                - $class: xkfe5hh
                  traverse: '1:0:0:0'
                - $class: xg1prrt
                  traverse: '0:1:0:0:0'
              min: 6
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 2
            value: Following
          silent: true
        - type: wait
          for: 1s
          silent: true
        - type: click
          selectorType: ai
          selector:
            - $matches:
                - $tag: DIV
                - $class: x9f619
                - $class: xjbqb8w
                - $class: x78zum5
                - $class: x168nmei
                - $class: x13lgxp2
                - $class: x5pf9jr
                - $class: xo71vjh
                - $class: x1pi30zi
                - $class: x1swvt13
                - $class: x1l90r2v
                - $class: xyamay9
                - $class: x1uhb9sk
                - $class: x1plvlek
                - $class: xryxfnj
                - $class: x1c4vz4f
                - $class: x2lah0s
                - $class: xdt5ytf
                - $class: xqjyukv
                - $class: x1qjc9v5
                - $class: x1oa3qoh
                - $class: x1nhvcw1
                - $style: '-apple-system:14px:400:normal'
                - $content: Unfollow
                - $class: x7r02ix
                  traverse: '0:0:0:7:0'
                - $class: xf1ldfh
                  traverse: '0:0:0:7:0'
                - $class: x131esax
                  traverse: '0:0:0:7:0'
                - $class: xdajt7p
                  traverse: '0:0:0:7:0'
                - $class: xxfnqb6
                  traverse: '0:0:0:7:0'
                - $anchor: Restrict
                  shift: '0:50'
                - $text: Restrict
                  traverse: '-9:7:0'
                - $anchor: Mute
                  shift: '0:100'
              min: 24
            - $size: 1
          item:
            type: element
            container:
              __$ht: element
              id: 3
            value: Unfollow
          silent: true
        - type: wait
          for: 1s
          silent: true
        - type: say
          message: >-
            โŽ **[@{{username}}](https://www.instagram.com/{{username}}/)**
            unfollowed! 
    - type: wait
      for: custom-delay
      delay: '{{delay}}'
- condition: '{{action}} = follow'
  type: say
  message: โ˜‘๏ธ {{list.length}} followed.
- condition: '{{action}} = unfollow'
  type: say
  message: โ˜‘๏ธ {{list.length}} unfollowed.
Notice: Please read before using

This automation command is created by a community member. HARPA AI team does not audit community commands.

Please review the command carefully and only install if you trust the creator.

Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service
CAN WE STORE COOKIES?
Our website uses cookies for the purposes of accessibility and security. They also allow us to gather statistics in order to improve the website for you. More info: Privacy Policy