Home Reference Source

Function

Static Public Summary
public

cleanStyle(styleStr: string): string

Internal function to remove unuseful styles from a style string.

since 0.4.0
public

collectMedia is an internal function used to collect media info.

since 0.4.0
Static Private Summary
private

async fetchAndParse(url: String): $

Internal shorthand for fetching & parsing a general webpage.

since 0.2.0
private

normalize($: $): $

Don't use. Internal function of NormalizedWeChatArticle.

In case you really need it, it proceeds the content cheerio instance.

since 0.3.0

Static Public

public cleanStyle(styleStr: string): string since 0.4.0 source

import {cleanStyle} from 'wearticle/src/lib/style.js'

Internal function to remove unuseful styles from a style string.

Params:

NameTypeAttributeDescription
styleStr string

Original style string from style attribute.

Return:

string

Cleaned style string.

public collectMedia($: type): Array since 0.4.0 source

import {collectMedia} from 'wearticle/src/lib/media.js'

collectMedia is an internal function used to collect media info. Takes the raw $ and returns the array you can get by WeChatArticle#getMedia.

Params:

NameTypeAttributeDescription
$ type

Raw $. That means all elements in the original HTML.

Return:

Array

Static Private

private async fetchAndParse(url: String): $ since 0.2.0 source

import {fetchAndParse} from 'wearticle/src/utils.js'

Internal shorthand for fetching & parsing a general webpage.

Params:

NameTypeAttributeDescription
url String

URL to that page.

Return:

$

Returns a cheerio instance with the whole HTML from axios.

private normalize($: $): $ since 0.3.0 source

import {normalize} from 'wearticle/src/normalize.js'

Don't use. Internal function of NormalizedWeChatArticle.

In case you really need it, it proceeds the content cheerio instance.

Params:

NameTypeAttributeDescription
$ $

Return:

$