A C# library to detect the duration of a video, given its URL
$ dotnet add package ISchemm.DurationFinderThis library will attempt detect the duration of a video, given a URL that
points to either a raw video resource (that you might put in a <video> tag)
or a supported video-sharing site.
<meta itemprop="duration"> tag)<meta property="og:video:duration"> or <meta property="video:duration"> tag)<link> element to a JSON endpoint which contains a non-standard duration property)Additional providers that are not included in Providers.All but are used internally:
duration property)Twitch might also work with OpenGraphDurationProvider, but this can be hit and miss.
ChainedDurationProvider to combine multiple providers (or just use the static object Providers.All)GetDurationAsync(Uri) on the resulting provider objectEach provider will check the content type of the GET response, and only
download what data is necessary. The first provider to come up with a valid
duration value will be used, and any remaining providers will be skipped. If
none of the providers come up with a result, GetDurationAsync(Uri) will
check for a <link rel="canonical"> tag and try again (provided that the URL
in the tag has not been attempted yet).