cleanup Wayback https convert

This commit is contained in:
Collin M. Barrett 2018-08-29 08:19:35 -05:00
parent d6c7acdb57
commit 3375ea7bef

View file

@ -41,10 +41,11 @@ private static async Task<Availability> GetWaybackAvailability(string url)
private static string ParseUrlRaw(Closest closest)
{
var waybackUrl = closest.Url;
var indexOfUrlModification = waybackUrl.GetNthIndexOfChar(5, '/');
var waybackUrlHttps = waybackUrl.StartsWith("http:") ? "https" + waybackUrl.Substring(4) : waybackUrl;
var indexOfUrlModification = waybackUrlHttps.GetNthIndexOfChar(5, '/');
const string urlModification = "if_";
return "https" + waybackUrl.Substring(4, indexOfUrlModification - 4) + urlModification +
waybackUrl.Substring(indexOfUrlModification);
return waybackUrlHttps.Substring(0, indexOfUrlModification) + urlModification +
waybackUrlHttps.Substring(indexOfUrlModification);
}
private static DateTime ParseTimestampUtc(Closest closest) =>