public void ParseListpage(HttpContentModel response) { var r = response.response.GetHtml(); //Console.WriteLine(DateTime.Now.ToString()+"成功访问了百度"); var document = parser.ParseDocument(r); foreach (var item in document.QuerySelectorAll("div.tableWrap tr td:nth-child(1) a")) { string cName = item.TextContent; string url = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php"; Dictionary <string, string> _params = new Dictionary <string, string>(); _params.Add("resource_id", "6899"); _params.Add("query", "失信被执行人名单"); _params.Add("cardNum", ""); _params.Add("iname", cName); _params.Add("areaName", ""); _params.Add("ie", "utf-8"); _params.Add("oe", "utf-8"); _params.Add("format", "json"); _params.Add("t", DateHelper.GetTimestamp(DateTime.Now)); _params.Add("cb", "jQuery110208514957267839198_1561021902645"); _params.Add("_", DateHelper.GetTimestamp(DateTime.Now)); url = url + "?" + UrlHelper.ConvertUrlParams(_params); var meta = new MetaModel(); meta.Add("companyName", cName); this.http.Get(url, ParseCompanyPage, meta); } }
private void ParseRoadName(HttpContentModel response) { var doc = response.response.GetDocument(); var lists = doc.QuerySelectorAll("div.road_sahngjia.road_zm_list a"); foreach (var item in lists) { string road = item.TextContent.Trim(); string name = road + "1号"; string url = $"https://xin.baidu.com/s?q={System.Web.HttpUtility.UrlEncode(name)}&t=0"; MetaModel meta = new MetaModel(); meta.Add("num", 1); meta.Add("empty", 0); meta.Add("road", road); this.http.Get(url, this.ParseCompanyName, meta); } }
public override void Run() { var typeDictionary = new Dictionary <string, string>(); typeDictionary.Add("图书", "id6018"); var letters = new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "*" }; foreach (var key in typeDictionary.Keys) { string _id = typeDictionary[key]; foreach (var letter in letters) { string url = "https://itunes.apple.com" + $"/cn/genre/ios-{key}/{_id}?mt=8&letter={letter}&page=1#page"; MetaModel meta = new MetaModel(); meta.Add("page", 1); this.http.Get(url, ParseAppList, meta); break; } } }