$echo '{
< "targetUrl": "https://books.toscrape.com/",
< "userGoal": "Get me a list of all the books on the first page. For each book, I want its title, price, star rating, and whether it is in stock.",
< "actors": [
< {
< "name": "cheerio-scraper",
< "enabled": true,
< "input": {
< "maxRequestRetries": 3,
< "requestTimeoutSecs": 30,
< "maxPagesPerCrawl": 1,
< "pageFunction": "async function pageFunction(context) {\\n const { request, log, $ } = context;\\n try {\\n const title = $('\''title'\'').text() || '\'''\'';\\n const html = $('\''html'\'').html() || '\'''\'';\\n return {\\n url: request.url,\\n title: title,\\n html: html\\n };\\n } catch (error) {\\n log.error('\''Error in pageFunction:'\'', error);\\n return {\\n url: request.url,\\n title: '\'''\'',\\n html: '\'''\''\\n };\\n }\\n}",
< "proxyConfiguration": {
< "useApifyProxy": true
< }
< }
< },
< {
< "name": "web-scraper",
< "enabled": false,
< "input": {
< "maxRequestRetries": 3,
< "requestTimeoutSecs": 30,
< "maxPagesPerCrawl": 1,
< "pageFunction": "async function pageFunction(context) {\\n const { request, log, page } = context;\\n try {\\n const title = await page.title();\\n const html = await page.content();\\n return {\\n url: request.url,\\n title: title,\\n html: html\\n };\\n } catch (error) {\\n log.error('\''Error in pageFunction:'\'', error);\\n return {\\n url: request.url,\\n title: '\'''\'',\\n html: '\'''\''\\n };\\n }\\n}",
< "proxyConfiguration": {
< "useApifyProxy": true
< }
< }
< },
< {
< "name": "website-content-crawler",
< "enabled": true,
< "input": {
< "maxCrawlPages": 1,
< "crawler": "playwright",
< "proxyConfiguration": {
< "useApifyProxy": true
< }
< }
< },
< {
< "name": "playwright-scraper",
< "enabled": false,
< "input": {
< "maxRequestRetries": 2,
< "requestTimeoutSecs": 45,
< "maxPagesPerCrawl": 1,
< "pageFunction": "async function pageFunction(context) {\\n const { request, log, page } = context;\\n try {\\n const title = await page.title();\\n const html = await page.content();\\n return {\\n url: request.url,\\n title: title,\\n html: html\\n };\\n } catch (error) {\\n log.error('\''Error in pageFunction:'\'', error);\\n return {\\n url: request.url,\\n title: '\'''\'',\\n html: '\'''\''\\n };\\n }\\n}",
< "proxyConfiguration": {
< "useApifyProxy": true
< }
< }
< }
< ]
<}' |
<apify call ohlava/scrapercodegenerator --silent --output-dataset