rewriteDirectImgurURL

Takes a direct imgur link (one that points to an image) and rewrites it to instead point to the image's page.

Images (jpg, png, ...) can naturally not have titles, but the normal pages can.

version(WithWebtitlePlugin)
private @safe pure
rewriteDirectImgurURL
(
const string url
)

Parameters

url string

String link to rewrite.

Return Value

Type: auto

A rewritten string if it's a compatible imgur one, else the passed url.

Examples

{
    immutable directURL = "https://i.imgur.com/URHe5og.jpg";
    immutable rewritten = rewriteDirectImgurURL(directURL);
    assert((rewritten == "https://imgur.com/URHe5og"), rewritten);
}
{
    immutable directURL = "http://i.imgur.com/URHe5og.jpg";
    immutable rewritten = rewriteDirectImgurURL(directURL);
    assert((rewritten == "https://imgur.com/URHe5og"), rewritten);
}