Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamveritas/25ebadedd69d3fd5bf9e to your computer and use it in GitHub Desktop.
Save iamveritas/25ebadedd69d3fd5bf9e to your computer and use it in GitHub Desktop.
letsrevolutionizetesting.com challenge
using System;
using System.Net;
namespace letsrevolutionizetesting
{
class Challange
{
// very quick and dirty solution to solve the letsrevolutionizetesting.com challenge
static void Main(string[] args)
{
string follow = "http://letsrevolutionizetesting.com/challenge?id=461736456";
while (true)
{
string url2Follow = follow + "&format=json";
Console.WriteLine("following: {0}", url2Follow);
// get url = follow&format=json
string content = string.Empty;
using (WebClient client = new WebClient())
{
content = client.DownloadString(url2Follow);
}
// extract follow, if not present break while loop
if (content.Contains("follow"))
{
int startidx = content.IndexOf("\":\"", StringComparison.InvariantCultureIgnoreCase);
int length = content.Length - (startidx+1) - "\":\"".Length - 1; // startidx is zero based
follow = content.Substring(startidx + "\":\"".Length, length);
}
else
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment