CasperC
Apify & Crawlee3y ago
11 replies
Casper

How to input specific URLs?

I would like to add an input to my actor as such:

- "website1.com"
- "website2.com"

How can I do this best in the Apify input schema and how can I extract these URL strings in Typescript code?

The below approach unfortunately does not work:
interface InputSchema {
  companyWebsites: string[];
  sortBy: string;
  filterByStarRating: string;
  filterBylanguage: string;
  filterByVerified: string;
  startFromPageNumber: number;
  endAtPageNumber: number;
}
const input = await Actor.getInput<InputSchema>();
let companyWebsites: string[] | undefined = input?.companyWebsites;
companyWebsites?.forEach(function (companyWebsite) {
  console.log(companyWebsite);
});
Was this page helpful?