CA
genetic-orange
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:
5 Replies
Aproach looks correct, you need array of string in input https://docs.apify.com/academy/deploying-your-code/input-schema then create urls from strings.
genetic-orangeOP•2y ago
thanks should StringList or Json be used for editor type?
When I try to foreach loop the companyWebsites array and add it to an URL it seems to think it is an object instead: https://www.trustpilot.com/review/[object%20Object]?sort=recency&stars=5&languages=en&verified=true&page=2
the [object%20Object] should just be for example ebay.com
For example this:
Output this in console:
validating companyWebsites
{ url: 'trustpilot.com' }
I just need to output a simple sting, not an object as it does at the moment
@Apify
unwilling-turquoise•2y ago
Hey! Use:
console.log(companyWebsite.url);
. This probably happened because you used "editor": "requestListSources"
in the input schema file.genetic-orangeOP•2y ago
@lemurio Hi,
The schema looks like this so there is no url property:
I have tried with "editor": "json" and it also fails.
Do you have other suggestions?
Is there some standard way of handling such a scenario where you need to input different uri/urls in this context?
unwilling-turquoise•2y ago
hey, by input schema file I mean the file where you specify how the input for this actor would look like. To have the urls as a list of strings, the specification of the property could look like this
Specification (v1) | Platform | Apify Documentation
Learn how to define and easily validate a schema for your Actor's input with code examples. Provide an autogenerated input UI for your Actor's users.