Skip to main content

extract-content-mercury-utils

ai-research-agent / extractor/html-to-content/extract-content/extract-content-mercury-utils

Functions

brsToPs()

function brsToPs(document): any

Parameters

ParameterType

document

any

Returns

any


cleanAttributes()

function cleanAttributes(article, document): any

Parameters

ParameterType

article

any

document

any

Returns

any


cleanHOnes()

function cleanHOnes(article, document): any

Parameters

ParameterType

article

any

document

any

Returns

any


cleanImages()

function cleanImages(article, document): any

Parameters

ParameterType

article

any

document

any

Returns

any


convertNodeTo()

function convertNodeTo(
node,
document,
tag): any

Parameters

ParameterTypeDefault value

node

any

undefined

document

any

undefined

tag

string

"p"

Returns

any


convertToParagraphs()

function convertToParagraphs(document): any

Parameters

ParameterType

document

any

Returns

any


getAttrs()

function getAttrs(node): any

Parameters

ParameterType

node

any

Returns

any


isWordpress()

function isWordpress(document): boolean

Parameters

ParameterType

document

any

Returns

boolean


linkDensity()

function linkDensity(node): number

Parameters

ParameterType

node

any

Returns

number


nodeIsSufficient()

function nodeIsSufficient(node): boolean

Parameters

ParameterType

node

any

Returns

boolean


normalizeSpaces()

function normalizeSpaces(text): any

Parameters

ParameterType

text

any

Returns

any


paragraphize()

function paragraphize(
node,
document,
br): any

Parameters

ParameterTypeDefault value

node

any

undefined

document

any

undefined

br

boolean

false

Returns

any


removeEmpty()

function removeEmpty(article): any

Parameters

ParameterType

article

any

Returns

any


removeUnlessContent()

function removeUnlessContent(node, weight): void

Parameters

ParameterType

node

any

weight

any

Returns

void


rewriteTopLevel()

function rewriteTopLevel(article, document): any

Parameters

ParameterType

article

any

document

any

Returns

any


setAttr()

function setAttr(
node,
attr,
val): any

Parameters

ParameterType

node

any

attr

any

val

any

Returns

any


setAttrs()

function setAttrs(node, attrs): any

Parameters

ParameterType

node

any

attrs

any

Returns

any


stripJunkTags()

function stripJunkTags(
article,
document,
tags): any

Parameters

ParameterTypeDefault value

article

any

undefined

document

any

undefined

tags

any[]

[]

Returns

any


stripTags()

function stripTags(text, document): any

Parameters

ParameterType

text

any

document

any

Returns

any


stripUnlikelyCandidates()

function stripUnlikelyCandidates(document): any

Parameters

ParameterType

document

any

Returns

any


textLength()

function textLength(text): any

Parameters

ParameterType

text

any

Returns

any


withinComment()

function withinComment(node): boolean

Parameters

ParameterType

node

any

Returns

boolean