const processOrganicResult = (result: Organic) => Effect.gen(function *($) {
const html = yield $(zenrowsIdiomaticEffect(result.link))
if (!html) {
Console.log(`No html for ${result.title}`)
return null
}
const markdown = extractMarkdown(result.link, html)
if (!markdown) {
Console.log(`No markdown for ${result.title}`)
return null
}
return { url: result.link, title: result.title, markdown }
})
const allMarkdownResults = yield* $(Effect.forEach(allOrganicResults, processOrganicResult, {
concurrency: 4,
}))
const markdownResults = allMarkdownResults.filter(Boolean) as {
url: string
title: string
markdown: string
}[]
const processOrganicResult = (result: Organic) => Effect.gen(function *($) {
const html = yield $(zenrowsIdiomaticEffect(result.link))
if (!html) {
Console.log(`No html for ${result.title}`)
return null
}
const markdown = extractMarkdown(result.link, html)
if (!markdown) {
Console.log(`No markdown for ${result.title}`)
return null
}
return { url: result.link, title: result.title, markdown }
})
const allMarkdownResults = yield* $(Effect.forEach(allOrganicResults, processOrganicResult, {
concurrency: 4,
}))
const markdownResults = allMarkdownResults.filter(Boolean) as {
url: string
title: string
markdown: string
}[]