mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add support for identifying newsletters hosted on beehiiv.com
This commit is contained in:
parent
bba094fbcd
commit
2cb5cc065a
1 changed files with 19 additions and 0 deletions
|
|
@ -432,9 +432,28 @@ export const isProbablyNewsletter = (html: string): boolean => {
|
|||
return true
|
||||
}
|
||||
|
||||
const beehiivUrl = beehiivNewsletterHref(dom.window)
|
||||
if (beehiivUrl) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
const beehiivNewsletterHref = (dom: DOMWindow): string | undefined => {
|
||||
const readOnline = dom.document.querySelectorAll(
|
||||
'table tr td div a[class*="link"]'
|
||||
)
|
||||
let res: string | undefined = undefined
|
||||
readOnline.forEach((e) => {
|
||||
console.log('text content', e.textContent)
|
||||
if (e.textContent === 'Read Online') {
|
||||
res = e.getAttribute('href') || undefined
|
||||
}
|
||||
})
|
||||
return res
|
||||
}
|
||||
|
||||
const findNewsletterHeaderHref = (dom: DOMWindow): string | undefined => {
|
||||
const postLink = dom.document.querySelector('h1 a ')
|
||||
if (postLink) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue