ts-webcrawler
Version:
A typescript webcrawler library for downloading and parsing webpages
72 lines (71 loc) • 2.37 kB
TypeScript
export declare class Url {
private _url;
private _host;
private _protocol;
private _origin;
private _path;
private _folder;
private _query;
private _hash;
private _filename;
isValid: boolean;
isPage: boolean;
isAsset: boolean;
constructor(url: string);
toString(): string;
getFullUrl(): string;
/**
* Method returns host of url for example: domain.com
* @returns {string|null} Returns host of url
*/
getHost(): string | null;
/**
* Method returns protocol of url for example: http:// or https://
* @returns {string|null} Returns protocol of url
*/
getProtocol(): string | null;
/**
* Method returns origin of url for example: http://domain.com or https://domain.com
* @returns {string|null} Returns origin of url
*/
getOrigin(): string | null;
/**
* Method returns path of url for example: /path/to/file.php
* @returns {string|null} Returns path of url
*/
getPath(): string | null;
/**
* Method returns folder of url for example: /path/to/file
* @returns {string|null} Returns path of url
*/
getFolder(): string | null;
/**
* Method returns query of url as array of objects
* @returns {QueryValue[]} Returns query of url as array of objects
*/
getQuery(): QueryValue[];
/**
* Method returns hash of url for example: #hash
* @returns {string|null} Returns hash of url
*/
getHash(): string | null;
/**
* Method returns filename of url for example: file.ext
* @returns {string|null} Returns filename of url
*/
getFilename(): string | null;
/**
* Method returns comparable string of url without hash and query
*/
getComparable(): string;
static extractHash(url: string): string | null;
static extractQuery(url: string): Array<QueryValue> | null;
static extractFilename(url: string): string | null;
static extractPath(url: string): string | null;
static extractFolder(url: string): string | null;
static extractOrigin(url: string): string | null;
static extractHost(url: string): string | null;
static extractProtocol(url: string): string | null;
private static isPage;
private static isAsset;
}