using System; using System.IO; using System.Net; using System.Text; public class WebClientGet2 { static void Main() { string[,] b = new string[60, 5]; int gyou = 0; int kopisurukazu = 0; WebClient wc = new WebClient(); using (StreamReader r = new StreamReader(@"C:\Users\ハンバーガー\Desktop\糞\メモ\コピペ\copipe.txt")) { string line; while ((line = r.ReadLine()) != null) // 1行ずつ読み出し。 { b[kopisurukazu, gyou] = line; Console.WriteLine(b[kopisurukazu, gyou]); gyou++; if (gyou == 5) { kopisurukazu++; gyou = 0; } } Console.ReadLine(); } int count2 = 0; string file = @"C:\Users\ハンバーガー\Desktop\糞\メモ\コピペ\"; string[] urllist = new string[60]; string[] urllist2 = new string[60]; string[] title = new string[60]; while (count2", rssichi) - rssichi - 1); title[count3] = rss.Substring(titlenoichi = rss.IndexOf("", rssichi) + 7, rss.IndexOf("", rssichi) - titlenoichi); //記事のURLをファイルに書き込み //Encoding urlenc = Encoding.GetEncoding(b[count2, 4]); //StreamReader urlsr = new StreamReader(urlst, urlenc); //kijiurl2 = urlsr.ReadToEnd(); //urlst.Close(); //using (StreamWriter w = new StreamWriter(file + "kijinourl.txt")) //{ // w.WriteLine(kijiurl2 + kijiurl); //} } for (int count5 = 0; urllist2[count5] != null; count5++) { if (0 <= Array.IndexOf(urllist2, urllist[count5])) { Console.WriteLine("一致する要素が見つかりました"); } else { Console.WriteLine("一致する要素が見つかりませんでした"); Stream st = wc.OpenRead(urllist[count5]); Encoding enc = Encoding.GetEncoding(b[count2, 4]); StreamReader sr = new StreamReader(st, enc); string html = sr.ReadToEnd(); int a = html.Length; int honbunnohajimenoichi = html.IndexOf(b[count2, 1]) + b[count2, 1].Length; int tudukinohajimenoichi = html.IndexOf(b[count2, 2]);// - dat[count2, 2].Length; int owarinoichi = html.IndexOf(b[count2, 3]); string honbun = html.Substring(honbunnohajimenoichi, tudukinohajimenoichi - honbunnohajimenoichi); string tuduki = html.Substring(tudukinohajimenoichi, owarinoichi - tudukinohajimenoichi); using (StreamWriter w = new StreamWriter(file + @"アフィ\" + title[count5] + "title.txt")) { w.WriteLine(title[count5]); } using (StreamWriter w = new StreamWriter(file + @"アフィ\" + title[count5] + "honbun.txt")) { w.WriteLine(honbun); } using (StreamWriter w = new StreamWriter(file + @"アフィ\" + title[count5] + "tuduki.txt")) { w.WriteLine(tuduki); } } } Console.ReadLine(); urllist.CopyTo(urllist2, 0); for (int count4 = 0; urllist2[count4] != null; count4++) { Console.WriteLine(urllist2[count4]); //Console.ReadLine(); } count2++; } } }