CA
Crawlee & Apify8mo ago
fair-rose

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?
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);
});
})();
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);
});
})();
3 Replies
Hall
Hall8mo ago
View post on community site
This post has been pushed to the community knowledgebase. Any replies in this thread will be synced to the community site.
Apify Community
rising-crimson
rising-crimson8mo ago
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
{
"resultsLimit": 30,
"username": [
"zelenskyy_official",
"zuck"
]
}
{
"resultsLimit": 30,
"username": [
"zelenskyy_official",
"zuck"
]
}
fair-rose
fair-roseOP8mo ago
@Lukas Celnar I should've totally tried that!! Thanks so much for the feedback

Did you find this page helpful?