HARPA.AI
LIBRARYAPIGUIDESAI COMMANDSBLOG

๐Ÿ“ฆย ย LinkedIn Group Members Export

Exports up to 2,000 members from any LinkedIn group you belong to. To begin, open any LinkedIn group, join it and navigate to the members list page. #make #grid #linkedin

Created by Mei-Ling Zhang
Updated on Jan 3, 11:32
Installed 164 times
RUNS JS CODE

How to Use

IMPORT COMMAND

Content

- type: say
  message: >-
    ๐Ÿ’ก To begin, open any LinkedIn group, join it and navigate to the members
    list page.
- type: ask
  param: targetProfileCount
  message: How many LinkedIn profiles would you like to extract?
  options:
    - label: ๐Ÿ‘ค 100
      value: 100
    - label: ๐Ÿ‘ฅ 1k
      value: 1000
    - $custom
  default: ''
  vision:
    enabled: false
    mode: area
    send: true
    hint: ''
  optionsInvalid: false
- type: js
  code: |-
    async function scrollAndCollectProfiles(targetProfileCount) {
        const config = {
            scrollDelay: 2000,
            maxRetries: 3,
            selectors: {
                showMoreButton: '.artdeco-button--1',
                memberContainer: '.groups-members-list__results-list a',
                name: '.artdeco-entity-lockup__title',
                status: '.artdeco-entity-lockup__subtitle'
            }
        };

        const profiles = [];
        const uniqueProfileLinks = new Set();
        let retries = 0;

        async function scrollAndWait() {
            window.scrollTo(0, document.body.scrollHeight);
            await new Promise(resolve => setTimeout(resolve, config.scrollDelay));
        }

        function extractCurrentProfiles() {
            const containers = document.querySelectorAll(config.selectors.memberContainer);
            let newProfilesFound = false;

            containers.forEach(container => {
                const link = container.href;

                if (!uniqueProfileLinks.has(link)) {
                    const name = container.querySelector(config.selectors.name)?.textContent.trim() || 'No name';
                    const status = container.querySelector(config.selectors.status)?.textContent.trim() || 'No status';

                    profiles.push({ name, status, link });
                    uniqueProfileLinks.add(link);
                    newProfilesFound = true;
                }
            });

            return newProfilesFound;
        }

        while (profiles.length < targetProfileCount && retries < config.maxRetries) {
            const newProfilesFound = extractCurrentProfiles();
            if (profiles.length < targetProfileCount && !newProfilesFound) retries++;
            else retries = 0;

            await scrollAndWait();
            const showMoreButton = document.querySelector(config.selectors.showMoreButton);
            if (showMoreButton) {
                showMoreButton.click();
                await scrollAndWait();
            }
        }

        return profiles;
    }

    return scrollAndCollectProfiles(targetProfileCount);
  param: json
  timeout: 300000
  args: targetProfileCount
- param: action
  options:
    - label: โœ… DONE
      value: done
    - label: ๐Ÿ“ฆ EXPORT JSON
      value: export
  vision:
    enabled: false
    mode: area
    hint: ''
    send: true
  type: ask
  message: ''
  default: ''
  optionsInvalid: false
- type: stop
  condition: '{{action}} = done'
- what: param
  filename: linkedin-group-members.txt
  condition: '{{action}} = export'
  type: export
  param: json
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