Skip to content
This repository has been archived by the owner on Sep 10, 2019. It is now read-only.
/ UrlPreview Public archive

A .Net library for fetching enough information about a URL to provide a preview

Notifications You must be signed in to change notification settings

BinaryIdiot/UrlPreview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UrlPreview.net

A .Net Standard library for fetching enough information about a web page to provide a preview either through a URL or the raw HTML itself.

How to use

It's pretty simple! Here's a quick example:

// Fetch preview from a url
var urlPreview = new UrlPreview();
var cnnResult = await urlPreview.FetchPreviewFromUrlAsync("https://www.cnn.com");
System.Console.WriteLine(cnnResult.Title);

// Fetch a preview from Html
var urlPreview = new UrlPreview();
var htmlResult = urlPreview.FetchPreviewFromHtml(myHtml);
System.Console.WriteLine(htmlResult.Title);

Bot identification

Many sites require some sort of bot identification or it will fail. By default we supply a Mozilla compatible User Agent string with a bot name of URLPreviewBot and version of 1.0 but you can customize this!

// Simply provide values for the 'BotName' and 'BotVersion' properties
var urlPreview = new UrlPreview
{
    BotName = "CoolBot",
    BotVersion = "2.0"
};

Roadmap

This library is still very young and plenty of work is planned. Have suggestions for feedback? Please feel free to submit GitHub issues, Pull Requests or just contact me directly @KrisSiegel.

About

A .Net library for fetching enough information about a URL to provide a preview

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published