public void TestParseUrl() { var parser = new GetchuParser(); /* var urls = parser.GetUrls(0); Assert.AreNotEqual(urls.Count(), 0);*/ var novel = parser.ParsePage(@"http://www.getchu.com/soft.phtml?id=865277&gc=gc"); Console.WriteLine("Finished"); }
public static void DoWork() { List<NovelInfo> novelInfos; using (var ctx=new VNCommonContext("VNCommonConnectionString")) { novelInfos = ctx.NovelInfos.Where(w => w.Getchu != null).ToList(); } Assert.IsTrue(novelInfos.Any()); var parser=new GetchuParser(); int i = 0; foreach (var novelInfo in novelInfos) { i++; string url = null; try { url = parser.ProvideUrl(novelInfo); var novel = parser.ParsePage(url); novel.JapName = novelInfo.JapName; novel.Site = novelInfo.Site; novel.Source=NovelSource.Getchu; novel.SourceKey = novelInfo.Getchu; using (var ctx = new VNContext("GetchuConnectionString")) { ctx.Novels.Add(novel); ctx.SaveChanges(); } System.Console.WriteLine(i +@" finished"); } catch (Exception ex) { Logs.Error(String.Format(GetchuParser.ErrorMessagePattern, url,""),ex); System.Console.WriteLine(i + @" failed"); } } }