ts-webcrawler
Version:
A typescript webcrawler library for downloading and parsing webpages
51 lines (50 loc) • 1.49 kB
TypeScript
import { Url } from './Url';
export declare class Page {
url: Url;
data: string | null;
code: number | null;
loaded: boolean;
links: Url[];
files: Url[];
_loadingStart: number;
_loadingEnd: number;
ttfb: number;
constructor(url: string | Url);
getUrl(): string;
getUrlObject(): Url;
getData(): string | null;
getCode(): number | null;
getLinks(): Url[];
getFiles(): Url[];
/**
* Method loads page and returns promise with loaded page
* @param param0 {onload: (page: Page) => void} Callback function that is called when page is loaded
* @returns
*/
load({ onload }?: {
onload?: ((page: Page) => void) | undefined;
}): Promise<Page>;
getInternalLinks(): Url[];
getExternalLinks(): Url[];
getTtfb(): number;
getLang(): string | null;
getTitleTag(): string | null;
getMetaTag(name: string): string | null;
getMetaTags(): MetaTag[];
/**
* Method returns array of Url objects
* @returns {Url[]} Returns array of Url objects
*/
private processData;
/**
* Method returns array of Url objects
* @returns {Url[]} Returns array of Url objects
*/
private processAbsoluteLinks;
/**
* Method returns array of Url objects
* @returns {Url[]} Returns array of Url objects
*/
private processRelativeLinks;
static extractWords(html: string): string;
}