Apify

Apify and Crawlee Official Forum

b
F
A
J
A

Running multiple usernames through the input

Hi guys! I am wondering if I am able to put in multiple username fields into the input variable in this Actor or do I need to loop through to generate outputs for multiple usernames?
Plain Text
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with API token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "username": [
        "zelenskyy_official"
    ],
    "resultsLimit": 30
};

(async () => {
    // Run the Actor and wait for it to finish
    const run = await client.actor("xMc5Ga1oCONPmWJIa").call(input);

    // Fetch and print Actor results from the run's dataset (if any)
    console.log('Results from dataset');
    const { items } = await client.dataset(run.defaultDatasetId).listItems();
    items.forEach((item) => {
        console.dir(item);
    });
})();
L
1 comment
Hi @CORT
I see that you are trying to scrape instagram reel scraper
I checked an since the username input is list of strings you can definitely put more usernames

Plain Text
{
    "resultsLimit": 30,
    "username": [
        "zelenskyy_official",
        "zuck"
    ]
}
Add a reply
Sign up and join the conversation on Discord
Join