You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chandl/Imageboard.cs

28 lines
748 B

using System.Collections.Generic;
using System.Net;
using Newtonsoft.Json;
namespace imageboard
{
public class Post
{
public long no;
public long tim;
public string ext;
}
public class Thread
{
public List<Post> Posts;
}
public class ImageboardController
{
public static Thread GetThread(string board, int postNumber)
{
string threadURL = "https://a.4cdn.org/" + board + "/thread/" + postNumber + ".json";
var webclient = new WebClient();
string response = webclient.DownloadString(threadURL);
Thread threadObject = JsonConvert.DeserializeObject<Thread>(response);
return threadObject;
}
}
}