mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #652 from omnivore-app/fix/parse-partial-documents
If parsing fails, attempt adding <html> wrappers to a document
This commit is contained in:
commit
ac6df4d139
1 changed files with 9 additions and 1 deletions
|
|
@ -205,7 +205,8 @@ const applyHandlers = async (
|
|||
export const parsePreparedContent = async (
|
||||
url: string,
|
||||
preparedDocument: PreparedDocumentInput,
|
||||
isNewsletter?: boolean
|
||||
isNewsletter?: boolean,
|
||||
allowRetry = true
|
||||
): Promise<ParsedContentPuppeteer> => {
|
||||
const logRecord: ArticleParseLogRecord = {
|
||||
url: url,
|
||||
|
|
@ -236,6 +237,13 @@ export const parsePreparedContent = async (
|
|||
|
||||
try {
|
||||
article = getReadabilityResult(url, document, dom, isNewsletter)
|
||||
if (!article?.textContent && allowRetry) {
|
||||
const newDocument = {
|
||||
...preparedDocument,
|
||||
document: '<html>' + preparedDocument.document + '</html>',
|
||||
}
|
||||
return parsePreparedContent(url, newDocument, isNewsletter, false)
|
||||
}
|
||||
|
||||
// Format code blocks
|
||||
// TODO: we probably want to move this type of thing
|
||||
|
|
|
|||
Loading…
Reference in a new issue