/** * 强势选股-同花顺 * http://data.10jqka.com.cn/rank/cxfl/ **/ public static bool save_QSXG_THS(WebBrowser web) { NewsYw yw = null; string type = "创新股"; string url = web.Url.ToString(); if (url.IndexOf("lxsz") != -1) { type = "连续上涨"; } else if (url.IndexOf("cxfl") != -1) { type = "持续放量"; } else if (url.IndexOf("xstp") != -1) { type = "向上突波"; } else if (url.IndexOf("ljqs") != -1) { type = "量价齐升"; } else if (url.IndexOf("cxg") != -1) { type = "创新高"; } else if (url.IndexOf("cxd") != -1) { type = "创新低"; } else if (url.IndexOf("lxxd") != -1) { type = "连续下跌"; } else if (url.IndexOf("cxsl") != -1) { type = "持续缩量"; } else if (url.IndexOf("xxtp") != -1) { type = "向下突波"; } else if (url.IndexOf("ljqd") != -1) { type = "量较齐跌"; } int gn = 0; DateTime qbdate = DateTime.Now; String htmlText = ""; HtmlElementCollection trEles = null; HtmlElementCollection tdEles1 = null; foreach (HtmlElement item in web.Document.GetElementsByTagName("Table")) { if (item == null) { continue; } //表 if ("m-table J-ajax-table".Equals(item.GetAttribute("className"))) { trEles = item.Document.GetElementsByTagName("Tr"); int i = 0; foreach (HtmlElement tritem in trEles) { i++; if (i == 1) { continue; } htmlText = tritem.InnerText.Trim().Replace("\r\n", ""); string yg_type = ""; tdEles1 = tritem.GetElementsByTagName("Td"); if (tdEles1 == null || tdEles1.Count <= 0) { continue; } if (url.IndexOf("lxsz") != -1) { yg_type = tdEles1[6].InnerText.Trim(); } else if (url.IndexOf("cxfl") != -1) { yg_type = tdEles1[7].InnerText.Trim(); } else if (url.IndexOf("xstp") != -1) { yg_type = tdEles1[7].InnerText.Trim(); } else if (url.IndexOf("ljqs") != -1) { yg_type = tdEles1[4].InnerText.Trim(); } else if (url.IndexOf("cxg") != -1) { yg_type = tdEles1[4].InnerText.Trim(); } else if (url.IndexOf("cxd") != -1) { yg_type = tdEles1[4].InnerText.Trim(); } else if (url.IndexOf("lxxd") != -1) { yg_type = tdEles1[6].InnerText.Trim(); } else if (url.IndexOf("cxsl") != -1) { yg_type = tdEles1[7].InnerText.Trim(); } else if (url.IndexOf("xxtp") != -1) { yg_type = tdEles1[7].InnerText.Trim(); } else if (url.IndexOf("ljqd") != -1) { yg_type = tdEles1[4].InnerText.Trim(); } Console.WriteLine("yg_type:" + yg_type); yw = new NewsYw(); yw.from = type; yw.updtime = qbdate; yw.flag = 0; yw.remark = yg_type; yw.keystr = tdEles1[2].InnerText; Console.WriteLine(yw.keystr); if (!String.IsNullOrEmpty(yw.keystr)) { if (!isInsert(yw.keystr, yw.from)) { GPUtil.helper.ExecuteNonQuery("insert into Newsyw (flag,gn,newsfrom,keystr,remark,updtime) values (" + yw.flag + "," + gn + ",'" + yw.from + "','" + yw.keystr + "','" + yw.remark + "','" + yw.updtime + "')"); } } } } } return true; }
/** * 个股公告-同花顺 * http://data.10jqka.com.cn/market/ggsd/ **/ public static bool save_GGSD(WebBrowser web) { NewsYw yw = null; string type = "个股公告"; int gn = 0; string url = web.Url.ToString(); if (url.IndexOf("利好公告") != -1) { gn = 1; } else if (url.IndexOf("利空公告") != -1) { gn = -1; } else if (url.IndexOf("最新公告") != -1) { gn = 0; } DateTime qbdate = DateTime.Now; String htmlText = ""; HtmlElementCollection trEles = null; HtmlElementCollection tdEles1 = null; foreach (HtmlElement item in web.Document.GetElementsByTagName("Table")) { if (item == null) { continue; } //表 if ("m-table J-ajax-table".Equals(item.GetAttribute("className"))) { trEles = item.Document.GetElementsByTagName("Tr"); int i = 0; foreach (HtmlElement tritem in trEles) { i++; if (i == 1) { continue; } htmlText = tritem.InnerText.Trim().Replace("\r\n", ""); string yg_type = ""; tdEles1 = tritem.GetElementsByTagName("Td"); if (tdEles1 == null || tdEles1.Count <= 0) { continue; } qbdate = Convert.ToDateTime(tdEles1[1].InnerText.Trim()); if (tdEles1[8] != null) { yg_type = tdEles1[8].InnerText+"||"+ tdEles1[5].InnerText; } Console.WriteLine("yg_type:" + yg_type); yw = new NewsYw(); yw.from = type; yw.updtime = qbdate; yw.flag = 0; yw.remark = yg_type; yw.remark1 = tdEles1[6].InnerText.Trim(); yw.keystr = tdEles1[3].InnerText; Console.WriteLine(yw.keystr); if (!String.IsNullOrEmpty(yw.keystr)) { if (!isInsert(yw.keystr, yw.from)) { GPUtil.helper.ExecuteNonQuery("insert into Newsyw (flag,gn,newsfrom,keystr,remark,remark1,updtime) values (" + yw.flag + "," + gn + ",'" + yw.from + "','" + yw.keystr + "','" + yw.remark + "','"+yw.remark1+"','" + yw.updtime + "')"); } } } } } return true; }
/** * 异动观察-同花顺 * http://yuanchuang.10jqka.com.cn/zhangting/ **/ public static bool saveYDGC(WebBrowser web) { NewsYw yw = null; List<String> allKeys = new List<string>(); //allKeys.AddRange(KeyWordAPI.keyData.Keys); allKeys.AddRange(KeyWordAPI.gpNameList); int gn = 0; Object gnObj = null; DateTime qbdate = DateTime.Now; String htmlText = ""; foreach (HtmlElement item in web.Document.GetElementsByTagName("Div")) { if (item == null) { continue; } //表 if ("fl date".Equals(item.GetAttribute("className"))) { htmlText = item.InnerText.Trim().Replace("\r\n", ""); string[] tmps = htmlText.Split("|".ToCharArray()); qbdate = Convert.ToDateTime(tmps[1]); htmlText = item.Parent.Parent.InnerText.Trim().Replace("\r\n", ""); foreach (string key in allKeys) { if (htmlText.IndexOf(key) != -1) { yw = new NewsYw(); yw.from = "异动观察"; yw.updtime = qbdate; yw.flag = 0; yw.keystr = key; if (KeyWordAPI.keyData.Keys.Contains(key)) { gnObj = KeyWordAPI.keyData[key]; gn = Convert.ToInt32(gnObj); } else { gn = 0; } Console.WriteLine(yw.keystr); if (!String.IsNullOrEmpty(yw.keystr)) { if (!isInsert(yw.keystr, yw.from)) { GPUtil.helper.ExecuteNonQuery("insert into Newsyw (flag,gn,newsfrom,keystr,updtime) values (" + yw.flag + "," + gn + ",'" + yw.from + "','" + yw.keystr + "','" + yw.updtime + "')"); } } } } } } return true; }
/** *今日头条-同花顺 * http://www.10jqka.com.cn/ **/ public static bool saveTHS_JRDT(WebBrowser web) { NewsYw yw = null; String htmlText = ""; List<String> allKeys = new List<string>(); allKeys.AddRange(KeyWordAPI.keyData.Keys); allKeys.AddRange(KeyWordAPI.gpNameList); int gn = 0; Object gnObj = null; foreach (HtmlElement item in web.Document.GetElementsByTagName("Div")) { if (item == null) { continue; } //表 if ("jrtt ta-parent-box".Equals(item.GetAttribute("className")) || "item cjyw ta-parent-box".Equals(item.GetAttribute("className"))) { htmlText = item.InnerText.Trim().Replace("\r\n", ""); Console.WriteLine(htmlText); foreach (string key in allKeys) { if (htmlText.IndexOf(key) != -1) { yw = new NewsYw(); if ("jrtt ta-parent-box".Equals(item.GetAttribute("className"))) { yw.from = "今日要闻"; } else if ("item cjyw ta-parent-box".Equals(item.GetAttribute("className"))) { yw.from = "今日要闻"; } else if ("left yahei".Equals(item.GetAttribute("className")) || "box module ta-parent-box".Equals(item.GetAttribute("className")) || "box ta-parent-box".Equals(item.GetAttribute("className"))) { yw.from = "今日要闻"; } //yw.from = "今日要闻-同花顺"; yw.updtime = DateTime.Now; yw.flag = 0; yw.keystr = key; if (KeyWordAPI.keyData.Keys.Contains(key)) { gnObj = KeyWordAPI.keyData[key]; gn = Convert.ToInt32(gnObj); } else { gn = 0; } Console.WriteLine(yw.keystr); if (!String.IsNullOrEmpty(yw.keystr)) { if (!isInsert(yw.keystr, yw.from)) { GPUtil.helper.ExecuteNonQuery("insert into Newsyw (flag,gn,newsfrom,keystr,updtime) values (" + yw.flag + "," + gn + ",'" + yw.from + "','" + yw.keystr + "','" + DateTime.Now + "')"); } } } } } } return true; }
/** * 同花顺>数据中心>新股申购 *http://data.10jqka.com.cn/ipo/xgsgyzq/ **/ public static bool saveXGSG_GP(WebBrowser web) { NewsYw yw = null; string type = "新股申购"; string url = web.Url.ToString(); int gn = 0; DateTime qbdate = DateTime.Now; String htmlText = ""; HtmlElementCollection trEles = null; HtmlElementCollection tdEles1 = null; HtmlElement item = web.Document.GetElementById("maintable"); if (item == null) { return false; } trEles = item.Document.GetElementsByTagName("Tr"); int i = 0; foreach (HtmlElement tritem in trEles) { i++; if (i == 1) { continue; } htmlText = tritem.InnerText.Trim().Replace("\r\n", ""); string yg_type = ""; tdEles1 = tritem.GetElementsByTagName("Td"); if (tdEles1 == null || tdEles1.Count <= 0) { continue; } if (tdEles1[9] != null) { yg_type = tdEles1[9].InnerText; } Console.WriteLine("yg_type:" + yg_type); yw = new NewsYw(); yw.from = type; yw.updtime = qbdate; yw.flag = 0; yw.remark = yg_type; yw.keystr = tdEles1[1].InnerText; Console.WriteLine(yw.keystr); if (!String.IsNullOrEmpty(yw.keystr)) { if (!isInsert(yw.keystr, yw.from)) { GPUtil.helper.ExecuteNonQuery("insert into Newsyw (flag,gn,newsfrom,keystr,remark,updtime) values (" + yw.flag + "," + gn + ",'" + yw.from + "','" + yw.keystr + "','" + yw.remark + "','" + yw.updtime + "')"); } } } return true; }