Apify and Crawlee Official Forum

Updated 2 months ago

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
C
2 comments
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"
    ]
}
@Lukas Celnar I should've totally tried that!! Thanks so much for the feedback
Add a reply
Sign up and join the conversation on Discord