public void GetJobInfoParserTest() { Category catalog = new Category(); // TODO: 初始化为适当的值 Get1010Jobs target = new Get1010Jobs(catalog); // TODO: 初始化为适当的值 string url = "http://sh.1010jz.com/html/shanghai/011_1522688.html"; // TODO: 初始化为适当的值 Job expected = null; // TODO: 初始化为适当的值 Job actual; ATag node = new ATag(); node.Link = url; actual = target.GetJobInfoParser(url); Console.WriteLine("title:{0}", actual.title); Console.WriteLine("email:{0}", actual.poster_email); }
public void Run() { bool sign = true; IList<Category> catalogs = null; IList<City> citys = null; while (sign) { try { citys = CategoryMap.GetCitys(); catalogs = CategoryMap.GetCategorys(); sign = false; } catch (Exception ex) { SpiderEventLog.WriteWarningLog("开始加载目录地址出现数据库错误:"+ex.ToString()); sign = true; } } if (catalogs == null) { return; } foreach (City c in citys) { foreach (Category catalog in catalogs) { Category newCatalog = new Category(); newCatalog.id = catalog.id; newCatalog.name = catalog.name; newCatalog.sp1010 = catalog.sp1010.Replace("sh.", c.sub_domain + "."); newCatalog.city = c; new Get1010Jobs(newCatalog).StartSpider(); } } }
public Get1010Jobs(Category catalog) { Catalog = catalog; }