public void APITestfor5ch() { ViewModel test = new ViewModel(); test.Use5chnet = false; APIAccess api = new APIAccess("JYW2J6wh9z8p8xjGFxO3M2JppGCyjQ", "hO2QHdapzbqbTFOaJgZTKXgT2gWqYS", "X-2ch-UA: JaneStyle/4.0.0", "Mozilla/4.0 (compatible; JaneStyle/4.0.0)", "Mozilla/4.0 (compatible; JaneStyle/4.0.0)", "", "", ""); //APIAccess api = new APIAccess("eqCvjJPvTFUTI8JEc74lUQa0QWoNwF", "z3FZxjmD2hJrDYfOotFRNcmleILNtM", "X-2ch-UA: Hotzonu/2.0", "Monazilla/1.00 (Hotzonu/2.0)", "", "", ""); //var res = api.GetDat("mercury", "erodoujin", "1514457513", -1, null, false); var res = api.GetDat("rosie", "anime", "1518737340", -1, null, false); if (res.StatusCode == System.Net.HttpStatusCode.OK) { using (System.IO.StreamReader reader = new System.IO.StreamReader(res.GetResponseStream(), Encoding.GetEncoding("Shift_JIS"))) { String dat = reader.ReadToEnd(); } } }
public void ResReplace() { ViewModel test = new ViewModel(); //APIAccess api = new APIAccess("JYW2J6wh9z8p8xjGFxO3M2JppGCyjQ", "hO2QHdapzbqbTFOaJgZTKXgT2gWqYS", "X-2ch-UA: JaneStyle/3.84", "Monazilla/1.00 JaneStyle/3.84 Windows/10.0.15063", "", "", ""); APIAccess api = new APIAccess("eqCvjJPvTFUTI8JEc74lUQa0QWoNwF", "z3FZxjmD2hJrDYfOotFRNcmleILNtM", "X-2ch-UA: Hotzonu/2.0", "Monazilla/1.00 (Hotzonu/2.0)", "", "", "", ""); var res = api.GetDat("egg", "software", "1506944835", -1, null); if (res.StatusCode == System.Net.HttpStatusCode.OK) { using (System.IO.StreamReader reader = new System.IO.StreamReader(res.GetResponseStream(), Encoding.GetEncoding("Shift_JIS"))) { StringBuilder datb = new StringBuilder(reader.ReadToEnd()); var replace = Regex.Matches(datb.ToString(), @"((?:h?ttps?|sssp)://\w+?\.)5ch\.net(/test/read\.cgi/\w+?/\d{9,}?|/ico/\w+?\.gif|/[a-zA-Z0-9]+)"); foreach(Match link in replace) { datb.Replace(link.Groups[0].Value, link.Groups[1].Value + "2ch.net" + link.Groups[2].Value); } datb.Replace("https://", " http://"); } } }