fetchFromHttp method

Future<MetaInfo> fetchFromHttp(
  1. Uri url
)

Retrive MetaInfo from HTTP request from url.

If url is not HTTP or HTTPS, NonHttpUrlException will be thrown. Additionally, if url located neither HTML nor XHTML resources, ContentTypeMismatchedException will be thrown.

Optionally, userAgentString can be modified before making request that allowing to identify as another user agent rather than default one unless disguiseUserAgent set as true which override user agent string from web browser instead.

Once the request got response, it's body content will be html_parser.parse to Document directly and perform build MetaInfo.

HTTP response code does not matter in this method that it only required to retrive HTML content from url.

For fetch all metadata protocols in a single url, please uses fetchAllFromHttp instead.

Implementation

Future<MetaInfo> fetchFromHttp(Uri url) {
  return _fetchHtmlDocument(url).then(_buildMetaInfo);
}