Skip to content
Taiizor edited this page Mar 1, 2023 · 2 revisions

WebExtension Class

The WebExtension class provides extension methods for web-related operations such as retrieving the source code, calculating the code-to-text ratio, and getting the web header information of a URL.

Properties

The WebExtension class contains the following properties:

  • ECWT.CompressWebType: an enum that specifies the type of web compression to use
  • EHWT.HttpWebType: an enum that specifies the type of HTTP web request to use
  • MI.Internal: a class that provides internal management methods
  • MWWM.WebManage: a class that provides web management methods

Methods

Source

public static string Source(string Url = MWWM.Url)

This method retrieves the source code of the web page at the specified URL.

Parameters

  • Url: (optional) the URL of the web page to retrieve (default: MWWM.Url)

Returns

A string containing the source code of the web page.

Exceptions

If an error occurs while retrieving the web page, a Skylark.Exception is thrown.

SourceAsync

public static Task<string> SourceAsync(string Url = MWWM.Url)

This method retrieves the source code of the web page at the specified URL asynchronously.

Parameters

  • Url: (optional) the URL of the web page to retrieve (default: MWWM.Url)

Returns

A Task<string> that represents the asynchronous operation. The result of the task is a string containing the source code of the web page.

Exceptions

If an error occurs while retrieving the web page, a Skylark.Exception is thrown.

Ratio

public static SWWRS Ratio(string Url = MWWM.Url, bool Separator = MWWM.Separator)

This method calculates the code-to-text ratio of the web page at the specified URL.

Parameters

  • Url: (optional) the URL of the web page to calculate the ratio for (default: MWWM.Url)
  • Separator: (optional) a boolean value that specifies whether to use a separator for the returned values (default: MWWM.Separator)

Returns

A SWWRS struct that contains the following properties:

  • Rate: a string representing the code-to-text ratio of the web page
  • Total: a string representing the total length of the web page in bytes
  • Text:
Clone this wiki locally