Exemplo n.º 1
0
        public ActionResult GetValue()
        {
            WebClient wc = new WebClient();

            wc.Encoding = Encoding.UTF8;
            string html = wc.DownloadString("https://finance.naver.com/item/main.nhn?code=005930");
            // oRTK 부터 ~ noHTP 사이의 Json만 적출해온다.
            string json = JsonExport.Between(html, "<p class=\"no_today\">", "</p>");

            json = JsonExport.Between(json, "<span class=\"blind\">", "</span>");

            //var p = new Stock_Money { value = json };
            //string jsonString = JsonConvert.SerializeObject(p);
            //Stock_Money pObj = JsonConvert.DeserializeObject<Stock_Money>(jsonString);

            var jsonData = json;

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult GetRealTimeKospi()
        {
            WebClient wc = new WebClient();

            wc.Encoding = Encoding.UTF8;

            string html = wc.DownloadString("https://finance.naver.com/");
            string json = JsonExport.Between(html, "<div class=\"heading_area\"> ", "</div>");

            json = JsonExport.Between(json, "<span class=\"num\">", "</span>");

            var jsonData = json.Replace(",", "");

            if (jsonData != "")
            {
                modelChart.SetKospiPoint(jsonData);
            }

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }