mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Remove file, this is moved into the parser
This commit is contained in:
parent
b5f9478350
commit
d66c114a7d
1 changed files with 0 additions and 25 deletions
|
|
@ -1,25 +0,0 @@
|
|||
import { Readability } from '@omnivore/readability';
|
||||
import { DOMWindow } from 'jsdom'
|
||||
|
||||
|
||||
// Attempt to determine if an HTML blob is a newsletter
|
||||
// based on it's contents.
|
||||
export const isProbablyNewsletter = (dom: DOMWindow): boolean => {
|
||||
const article = new Readability(document, {
|
||||
debug: false,
|
||||
keepTables: true,
|
||||
}).parse()
|
||||
|
||||
if (!article || !article.content) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Maybe it is a substack newsletter
|
||||
const body = dom.document.querySelector('.email-body-container')
|
||||
if (body?.querySelector('.post-meta') || body?.querySelector('.post-cta')) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
};
|
||||
|
||||
Loading…
Reference in a new issue