예제 #1
0
 protected abstract void Execute(IScrapping scrap);
예제 #2
0
 protected override void Execute(IScrapping scrap)
 {
 }
예제 #3
0
        protected override void Execute(IScrapping scrap)
        {
            try
            {
                //http://localhost:10000/?type=scrap_request&code=006&apply=2&id=wogjsl0213&pw=dhwogjs02!
                //It deny the tag to speed up scrapping.
                scrap.AddPrintDenyTagName("META");
                scrap.AddPrintDenyTagName("SCRIPT");
                scrap.AddPrintDenyTagName("LINK");
                scrap.AddPrintDenyTagName("NOSCRIPT");
                scrap.AddPrintDenyTagName("STYLE");

                scrap.Move("https://www.esmplus.com/Member/SignIn/LogOn");

                scrap.ClickByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/DIV[1]/LABEL[1]/INPUT[0]");
                scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[1]/INPUT[0]", ID);
                scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[1]/INPUT[1]", PW);
                IHTMLElement element = scrap.GetElementByXPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[2]/A[1]/IMG[0]");
                element.outerHTML = "<input type=button onclick='onSubmit(\"SITE\");' value='go'>";
                scrap.SetDocumentCount(3);
                scrap.ClickByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[2]/A[1]/INPUT[0]");
                String urlBuffer = scrap.GetUrl();
                if (urlBuffer.IndexOf("LogOn") > 0)
                {
                    SetData(0, false);
                    return;
                }
                SetData(0, true);
                scrap.Move("https://www.esmplus.com/Home/SSO?code=TDM155");
                Console.WriteLine(scrap.GetUrl());

                SetData(1, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[0]/TD[1]/SPAN[0]/SPAN[0]"));
                SetData(2, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[11]/TD[1]/SPAN[0]"));
                String email = scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[18]/TD[1]/DIV[0]/DIV[0]/INPUT[0]");
                email += "@";
                email += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[18]/TD[1]/DIV[0]/DIV[2]/INPUT[0]");
                SetData(3, email);
                SetData(4, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[12]/TD[1]/SPAN[0]"));
                String number1 = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[15]/TD[1]/DIV[0]/DIV[2]/SELECT[2]");
                number1 += "-";
                number1 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[15]/TD[1]/DIV[0]/DIV[4]/INPUT[0]");
                number1 += "-";
                number1 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[15]/TD[1]/DIV[0]/DIV[6]/INPUT[0]");
                SetData(5, number1);
                String number2 = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[16]/TD[1]/DIV[0]/DIV[1]/SELECT[2]");
                number2 += "-";
                number2 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[16]/TD[1]/DIV[0]/DIV[3]/INPUT[0]");
                number2 += "-";
                number2 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[16]/TD[1]/DIV[0]/DIV[5]/INPUT[0]");
                SetData(6, number2);
                SetData(7, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/SPAN[19]/DIV[3]/TABLE[0]/TBODY[2]/TR[4]/TD[1]/UL[1]/LI[0]/DIV[1]/TABLE[0]/TBODY[1]/TR[1]/TD[1]/LABEL[0]"));
                SetData(8, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/SPAN[19]/DIV[3]/TABLE[0]/TBODY[2]/TR[4]/TD[1]/UL[1]/LI[0]/DIV[1]/TABLE[0]/TBODY[1]/TR[0]/TD[1]/LABEL[0]"));
                SetData(9, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/SPAN[19]/DIV[3]/TABLE[0]/TBODY[2]/TR[4]/TD[1]/UL[1]/LI[0]/DIV[1]/TABLE[0]/TBODY[1]/TR[2]/TD[1]/LABEL[0]"));
                SetData(10, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[9]/TD[1]/SPAN[0]"));
                SetData(11, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[11]/TD[1]/SPAN[0]"));
                SetData(13, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[11]/TD[3]/SPAN[0]"));
                SetData(14, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[12]/TD[1]/SPAN[0]"));
            }
            catch (Exception e)
            {
                SetEventHandler(ScrapState.ERROR);
                ErrorLog(e.ToString());
            }
        }
예제 #4
0
        protected override void Execute(IScrapping scrap)
        {
            //It deny the tag to speed up scrapping.
            scrap.AddPrintDenyTagName("META");
            scrap.AddPrintDenyTagName("SCRIPT");
            scrap.AddPrintDenyTagName("LINK");
            scrap.AddPrintDenyTagName("NOSCRIPT");
            scrap.AddPrintDenyTagName("STYLE");

            scrap.Move("https://www.esmplus.com/Member/SignIn/LogOn");

            scrap.ClickByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/DIV[1]/LABEL[1]/INPUT[0]");
            scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[1]/INPUT[0]", ID);
            scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[1]/INPUT[1]", PW);
            IHTMLElement element = scrap.GetElementByXPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[2]/A[1]/IMG[0]");

            element.outerHTML = "<input type=button onclick='onSubmit(\"SITE\");' value='go'>";
            scrap.SetDocumentCount(3);
            scrap.ClickByxPath("HTML[0]/BODY[1]/DIV[0]/DIV[2]/DIV[0]/DIV[0]/DIV[1]/DIV[0]/DIV[4]/DIV[0]/DIV[0]/DIV[0]/FORM[3]/FIELDSET[4]/DIV[2]/A[1]/INPUT[0]");
            String urlBuffer = scrap.GetUrl();

            if (urlBuffer.IndexOf("LogOn") > 0)
            {
                SetData(0, false);
                return;
            }
            SetData(0, true);
            scrap.Move("https://www.esmplus.com/Home/SSO?code=TDM155");
            Console.WriteLine(scrap.GetUrl());

            SetData(1, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[0]/TD[1]/SPAN[0]/SPAN[0]"));
            SetData(2, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[11]/TD[1]/SPAN[0]"));
            String email = scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[18]/TD[1]/DIV[0]/DIV[0]/INPUT[0]");

            email += "@";
            email += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[18]/TD[1]/DIV[0]/DIV[2]/INPUT[0]");
            SetData(3, email);
            SetData(4, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[12]/TD[1]/SPAN[0]"));
            String number1 = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[15]/TD[1]/DIV[0]/DIV[2]/SELECT[2]");

            number1 += "-";
            number1 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[15]/TD[1]/DIV[0]/DIV[4]/INPUT[0]");
            number1 += "-";
            number1 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[15]/TD[1]/DIV[0]/DIV[6]/INPUT[0]");
            SetData(5, number1);
            String number2 = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[16]/TD[1]/DIV[0]/DIV[1]/SELECT[2]");

            number2 += "-";
            number2 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[16]/TD[1]/DIV[0]/DIV[3]/INPUT[0]");
            number2 += "-";
            number2 += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[16]/TD[1]/DIV[0]/DIV[5]/INPUT[0]");
            SetData(6, number2);
            SetData(7, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/SPAN[19]/DIV[3]/TABLE[0]/TBODY[2]/TR[4]/TD[1]/UL[1]/LI[0]/DIV[1]/TABLE[0]/TBODY[1]/TR[1]/TD[1]/LABEL[0]"));
            SetData(8, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/SPAN[19]/DIV[3]/TABLE[0]/TBODY[2]/TR[4]/TD[1]/UL[1]/LI[0]/DIV[1]/TABLE[0]/TBODY[1]/TR[0]/TD[1]/LABEL[0]"));
            SetData(9, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/SPAN[19]/DIV[3]/TABLE[0]/TBODY[2]/TR[4]/TD[1]/UL[1]/LI[0]/DIV[1]/TABLE[0]/TBODY[1]/TR[2]/TD[1]/LABEL[0]"));
            SetData(10, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[9]/TD[1]/SPAN[0]"));
            SetData(11, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[11]/TD[1]/SPAN[0]"));
            SetData(13, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[11]/TD[3]/SPAN[0]"));
            SetData(14, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[0]/DIV[0]/FORM[24]/DIV[5]/DIV[1]/DIV[17]/TABLE[1]/TBODY[2]/TR[12]/TD[1]/SPAN[0]"));

            scrap.PrintElementXPath("d:\\mappath1.csv");

            Console.WriteLine(scrap.GetUrl());
            Console.WriteLine("Complete");
        }
예제 #5
0
 protected override void Execute(IScrapping scrap)
 {
     //TODO : http://localhost:10000/?type=scrap_request&code=999&apply=1&id=TEST&pw=TEST
 }
예제 #6
0
        protected override void Execute(IScrapping scrap)
        {
            try
            {
                LOG.Debug("START");
                scrap.AddPrintDenyTagName("META");
                scrap.AddPrintDenyTagName("SCRIPT");
                scrap.AddPrintDenyTagName("LINK");
                scrap.AddPrintDenyTagName("NOSCRIPT");
                scrap.AddPrintDenyTagName("STYLE");
                scrap.Move("http://domeggook.com/main/member/mem_formLogin.php?back=L21haW4vaW5kZXgucGhw");
                LOG.Debug(scrap.GetUrl());
                scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[10]/DIV[0]/FORM[1]/DIV[6]/INPUT[0]", base.ID);
                scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[10]/DIV[0]/FORM[1]/DIV[6]/INPUT[1]", base.PW);
                scrap.ClickByxPath("HTML[0]/BODY[1]/DIV[10]/DIV[0]/FORM[1]/DIV[6]/INPUT[2]");
                LOG.Debug(scrap.GetUrl());

                {
                    LOG.Debug(scrap.GetUrl());
                    scrap.Move("http://domeggook.com/main/member/mem_formRegular.php?mode=editRegular&back=L21haW4vaW5kZXgucGhw");
                    //회원아이디
                    SetData(1, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[0]/TD[1]/B[0]"));
                    //회원이름
                    SetData(2, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[9]/TD[1]"));
                    //이메일주소
                    String email = scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[11]/TD[1]/INPUT[0]");
                    email += "@";
                    email += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[11]/TD[1]/INPUT[2]");
                    SetData(3, email);
                    //주소
                    String address = scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[15]/TD[1]/TABLE[2]/TBODY[0]/TR[0]/TD[0]/INPUT[0]");
                    address += " ";
                    address += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[15]/TD[1]/TABLE[2]/TBODY[0]/TR[1]/TD[0]/INPUT[0]");
                    address += " ";
                    address += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[15]/TD[1]/TABLE[2]/TBODY[0]/TR[2]/TD[0]/INPUT[0]");
                    SetData(4, address);
                    //전화번호
                    String tel = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[17]/TD[1]/SELECT[0]");
                    tel += " - ";
                    tel += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[17]/TD[1]/INPUT[2]");
                    tel += " - ";
                    tel += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[17]/TD[1]/INPUT[4]");
                    SetData(5, tel);
                    //휴대전화번호
                    String hp = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[19]/TD[1]/SELECT[0]");
                    hp += " - ";
                    hp += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[19]/TD[1]/INPUT[2]");
                    hp += " - ";
                    hp += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[19]/TD[1]/INPUT[4]");
                    SetData(6, hp);
                    //예금주명
                    SetData(7, scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[10]/TBODY[2]/TR[0]/TD[1]/INPUT[0]"));
                    //은행선택
                    SetData(8, scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[10]/TBODY[2]/TR[0]/TD[3]/SELECT[0]"));
                    //계좌번호
                    SetData(9, scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[10]/TBODY[2]/TR[2]/TD[1]/INPUT[0]"));
                    //상호명
                    SetData(10, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[0]/TD[1]"));
                    //대표자명
                    SetData(11, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[2]/TD[1]"));
                    //부서명
                    SetData(12, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[4]/TD[1]"));
                    //업태
                    SetData(13, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[7]/TD[1]"));
                    //사업자주소
                    SetData(14, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[9]/TD[1]"));
                    //사업자대표번호
                    SetData(15, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[11]/TD[1]"));
                    //사업자소개
                    SetData(16, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[15]/TD[1]"));
                    //사업자유형
                    SetData(17, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[0]/TD[3]"));
                    //사업자등록번호
                    SetData(18, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[2]/TD[3]"));
                    //담당자명
                    SetData(19, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[4]/TD[3]"));
                    //업종
                    SetData(20, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[7]/TD[3]"));
                }
                {
                    LOG.Debug(scrap.GetUrl());
                    scrap.Move("http://domeggook.com/main/myPage/emoney/my_emoneyList.php?stitle=&quick=&y1=2015&m1=10&d1=01&y2=2016&m2=10&d2=17&x=34&y=13");
                    //총잔액
                    SetData(21, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[3]/TBODY[1]/TR[1]/TD[7]/B[0]"));
                }
                String[] site      = new String[] { "domeggook.com", "domeme.domeggook.com" };
                String[] modeType  = new String[] { "WAITPAY", "WAITCONFIRM", "WAITDELI", "WAITOK", "WAITSERV", "DENYCONFIRM", "DENYCONFIRM", "DENYBUY" };
                int      dataindex = 22;
                foreach (String s in site)
                {
                    String divIndex;
                    if ("domeggook.com".Equals(site))
                    {
                        divIndex = "17";
                    }
                    else
                    {
                        divIndex = "32";
                    }
                    foreach (String mode in modeType)
                    {
                        DateTime today    = DateTime.Now;
                        DateTime fromDay  = today.AddMonths(-3);
                        int      sum      = 0;
                        bool     nextpage = true;
                        for (int pageIndex = 0; nextpage; pageIndex++)
                        {
                            scrap.Move("http://" + s + "/main/mySell/sell/my_sellList.php?&mode=" + mode + "&quick=&y1=" + fromDay.Year + "&m1=" + fromDay.Month + "&d1=" + fromDay.Day + "&y2=" + today.Year + "&m2=" + today.Month + "&d2=" + today.Day + "&sno=&stt=&sid=&sqt=&sam=&dtype=o&ob=p&pagenum=" + pageIndex);
                            LOG.Debug(scrap.GetUrl());
                            nextpage = false;
                            //scrap.PrintElementXPath("d:\\mapPath.csv");
                            for (int line = 2; true; line++)
                            {
                                if (!scrap.IsElementByXPath("HTML[0]/BODY[1]/DIV[" + divIndex + "]/DIV[1]/DIV[1]/DIV[2]/FORM[1]/TABLE[4]/TBODY[0]/TR[" + line + "]/TD[5]/DIV[0]"))
                                {
                                    break;
                                }
                                nextpage = true;
                                String value = scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[" + divIndex + "]/DIV[1]/DIV[1]/DIV[2]/FORM[1]/TABLE[4]/TBODY[0]/TR[" + line + "]/TD[5]/DIV[0]");
                                value = value.Replace(",", "").Replace("원", "");
                                sum  += Convert.ToInt32(value);
                            }
                        }
                        SetData(dataindex, sum);
                        dataindex++;
                    }
                }
            }
            catch (Exception e)
            {
                if (this.eventhandler != null)
                {
                    eventhandler(ScrapState.ERROR);
                }
                LOG.Error(e.ToString());
            }
        }
예제 #7
0
        /// <summary>
        /// This is thing that scrapping is start.
        /// </summary>
        /// <value>
        /// 1 : 회원정보
        /// 2 : 회원이름
        /// 3 : 이메일
        /// 4 : 주소
        /// 5 : 전화번호
        /// 6 : 핸드폰번호
        /// 7 : 예금주 이름
        /// 8 : 은행 종류
        /// 9 : 계좌 번호
        /// 10 : 회사 이름
        /// 11 : 대표자 이름
        /// 12 : 부서명
        /// 13 : 업종
        /// 14 : 회사 이름
        /// 15 : 회사 전화번호
        /// 16 : 회사 소개
        /// 17 : 사업 종류
        /// 18 : 사업자 번호
        /// 19 : 담당자 이름
        /// 20 : 업태
        /// 21 : 총금액
        /// 22 : 3개월전 입금예정 - 도매꾹
        /// 23 : 2개월전 입금예정 - 도매꾹
        /// 24 : 1개월전 입금예정 - 도매꾹
        /// 25 : 3개월전 승인대기 - 도매꾹
        /// 26 : 2개월전 승인대기 - 도매꾹
        /// 27 : 1개월전 승인대기 - 도매꾹
        /// 28 : 3개월전 발송예정 - 도매꾹
        /// 29 : 2개월전 발송예정 - 도매꾹
        /// 30 : 1개월전 발송예정 - 도매꾹
        /// 31 : 3개월전 배송중 - 도매꾹
        /// 32 : 2개월전 배송중 - 도매꾹
        /// 33 : 1개월전 배송중 - 도매꾹
        /// 34 : 3개월전 적립예정 - 도매꾹
        /// 35 : 2개월전 적립예정 - 도매꾹
        /// 36 : 1개월전 적립예정 - 도매꾹
        /// 37 : 3개월전 승인취소 - 도매꾹
        /// 38 : 2개월전 승인취소 - 도매꾹
        /// 39 : 1개월전 승인취소 - 도매꾹
        /// 40 : 3개월전 판매취소 - 도매꾹
        /// 41 : 2개월전 판매취소 - 도매꾹
        /// 42 : 1개월전 판매취소 - 도매꾹
        /// 43 : 3개월전 구매취소 - 도매꾹
        /// 44 : 2개월전 구매취소 - 도매꾹
        /// 45 : 1개월전 구매취소 - 도매꾹
        /// 46 : 3개월전 입금예정 - 도매매
        /// 47 : 2개월전 입금예정 - 도매매
        /// 48 : 1개월전 입금예정 - 도매매
        /// 49 : 3개월전 승인대기 - 도매매
        /// 50 : 2개월전 승인대기 - 도매매
        /// 51 : 1개월전 승인대기 - 도매매
        /// 52 : 3개월전 발송예정 - 도매매
        /// 53 : 2개월전 발송예정 - 도매매
        /// 54 : 1개월전 발송예정 - 도매매
        /// 55 : 3개월전 배송중 - 도매매
        /// 56 : 2개월전 배송중 - 도매매
        /// 57 : 1개월전 배송중 - 도매매
        /// 58 : 3개월전 적립예정 - 도매매
        /// 59 : 2개월전 적립예정 - 도매매
        /// 60 : 1개월전 적립예정 - 도매매
        /// 61 : 3개월전 승인취소 - 도매매
        /// 62 : 2개월전 승인취소 - 도매매
        /// 63 : 1개월전 승인취소 - 도매매
        /// 64 : 3개월전 판매취소 - 도매매
        /// 65 : 2개월전 판매취소 - 도매매
        /// 66 : 1개월전 판매취소 - 도매매
        /// 67 : 3개월전 구매취소 - 도매매
        /// 68 : 2개월전 구매취소 - 도매매
        /// 69 : 1개월전 구매취소 - 도매매
        /// </value>
        protected override void Execute(IScrapping scrap)
        {
            // TODO : The url of the data of the test is following next:
            // http://localhost:10000/?type=scrap_request&code=002&apply=2&id=storehouse&pw=hana0911!
            try
            {
                DebugLog("START");
                //It deny the tag to speed up scrapping.
                scrap.AddPrintDenyTagName("META");
                scrap.AddPrintDenyTagName("SCRIPT");
                scrap.AddPrintDenyTagName("LINK");
                scrap.AddPrintDenyTagName("NOSCRIPT");
                scrap.AddPrintDenyTagName("STYLE");

                scrap.Move("http://domeggook.com/main/member/mem_formLogin.php?back=L21haW4vaW5kZXgucGhw");
                DebugLog(scrap.GetUrl());
                scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[10]/DIV[0]/FORM[1]/DIV[6]/INPUT[0]", base.ID);
                scrap.SetInputValueByxPath("HTML[0]/BODY[1]/DIV[10]/DIV[0]/FORM[1]/DIV[6]/INPUT[1]", base.PW);
                scrap.ClickByxPath("HTML[0]/BODY[1]/DIV[10]/DIV[0]/FORM[1]/DIV[6]/INPUT[2]");

                DebugLog(scrap.GetUrl());
                String urlBuffer = scrap.GetUrl();
                //it fault login.
                if (urlBuffer.IndexOf("mem_formLogin.php") > 0)
                {
                    SetData(0, false);
                    return;
                }
                SetData(0, true);

                {
                    DebugLog(scrap.GetUrl());
                    //It move site to following next:
                    scrap.Move("http://domeggook.com/main/member/mem_formRegular.php?mode=editRegular&back=L21haW4vaW5kZXgucGhw");

                    LOG.Info("It is scripted  following next: The ID of member - 1");
                    SetData(1, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[0]/TD[1]/B[0]"));

                    LOG.Info("It is scripted  following next: The name of member - 2");
                    SetData(2, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[9]/TD[1]"));

                    LOG.Info("It is scripted  following next: Email - 3");
                    String email = scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[11]/TD[1]/INPUT[0]");
                    email += "@";
                    email += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[11]/TD[1]/INPUT[2]");
                    SetData(3, email);

                    LOG.Info("It is scripted  following next: address - 4");
                    String address = scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[15]/TD[1]/TABLE[2]/TBODY[0]/TR[0]/TD[0]/INPUT[0]");
                    address += " ";
                    address += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[15]/TD[1]/TABLE[2]/TBODY[0]/TR[1]/TD[0]/INPUT[0]");
                    address += " ";
                    address += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[15]/TD[1]/TABLE[2]/TBODY[0]/TR[2]/TD[0]/INPUT[0]");
                    SetData(4, address);

                    LOG.Info("It is scripted  following next: telephone number - 5");
                    String tel = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[17]/TD[1]/SELECT[0]");
                    tel += " - ";
                    tel += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[17]/TD[1]/INPUT[2]");
                    tel += " - ";
                    tel += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[17]/TD[1]/INPUT[4]");
                    SetData(5, tel);

                    LOG.Info("It is scripted  following next: mobile number. - 6");
                    String hp = scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[19]/TD[1]/SELECT[0]");
                    hp += " - ";
                    hp += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[19]/TD[1]/INPUT[2]");
                    hp += " - ";
                    hp += scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TBODY[3]/TR[19]/TD[1]/INPUT[4]");
                    SetData(6, hp);

                    LOG.Info("It is scripted  following next: The account name of bank - 7");
                    SetData(7, scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[10]/TBODY[2]/TR[0]/TD[1]/INPUT[0]"));

                    LOG.Info("It is scripted  following next: The type of bank - 8");
                    SetData(8, scrap.GetSelectValueByXPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[10]/TBODY[2]/TR[0]/TD[3]/SELECT[0]"));

                    LOG.Info("It is scripted  following next: The account number of bank - 9");
                    SetData(9, scrap.GetInputValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[10]/TBODY[2]/TR[2]/TD[1]/INPUT[0]"));

                    LOG.Info("It is scripted  following next: The name of company - 10");
                    SetData(10, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[0]/TD[1]"));

                    LOG.Info("It is scripted  following next: The name of boss - 11");
                    SetData(11, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[2]/TD[1]"));

                    LOG.Info("It is scripted  following next: The department - 12");
                    SetData(12, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[4]/TD[1]"));

                    LOG.Info("It is scripted  following next: The type of business  13");
                    SetData(13, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[7]/TD[1]"));

                    LOG.Info("It is scripted  following next: The address of company - 14");
                    SetData(14, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[9]/TD[1]"));

                    LOG.Info("It is scripted  following next: The phonenumber of company - 15");
                    SetData(15, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[11]/TD[1]"));

                    LOG.Info("It is scripted  following next: The introduce of company - 16");
                    SetData(16, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[15]/TD[1]"));

                    LOG.Info("It is scripted  following next: The type of business - 17");
                    SetData(17, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[0]/TD[3]"));

                    LOG.Info("It is scripted  following next: Business Number - 18");
                    SetData(18, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[2]/TD[3]"));

                    LOG.Info("It is scripted  following next: Contact person - 19");
                    SetData(19, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[4]/TD[3]"));

                    LOG.Info("It is scripted  following next: Sector - 20");
                    SetData(20, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[13]/FORM[0]/TABLE[17]/TBODY[2]/TR[7]/TD[3]"));
                }
                {
                    DebugLog(scrap.GetUrl());
                    scrap.Move("http://domeggook.com/main/myPage/emoney/my_emoneyList.php?stitle=&quick=&y1=2015&m1=10&d1=01&y2=2016&m2=10&d2=17&x=34&y=13");
                    //The total of price
                    SetData(21, scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[17]/DIV[1]/DIV[1]/DIV[2]/TABLE[3]/TBODY[1]/TR[1]/TD[7]/B[0]"));
                }
                //TODO: It should partition the data that total of price is scraped.
                String[] site      = new String[] { "domeggook.com", "domeme.domeggook.com" };
                String[] modeType  = new String[] { "WAITPAY", "WAITCONFIRM", "WAITDELI", "WAITOK", "WAITSERV", "DENYCONFIRM", "DENYSELL", "DENYBUY" };
                int      dataindex = 22;
                foreach (String s in site)
                {
                    String divIndex;
                    if ("domeggook.com".Equals(s))
                    {
                        divIndex = "17";
                    }
                    else
                    {
                        divIndex = "32";
                    }
                    foreach (String mode in modeType)
                    {
                        for (int period = 3; period > 0; period--)
                        {
                            DateTime today;
                            DateTime fromDay;
                            GetDate(period, out fromDay, out today);

                            int  sum      = 0;
                            bool nextpage = true;
                            for (int pageIndex = 0; nextpage; pageIndex++)
                            {
                                scrap.Move("http://" + s + "/main/mySell/sell/my_sellList.php?&mode=" + mode + "&quick=&y1=" + fromDay.Year + "&m1=" + fromDay.Month + "&d1=" + fromDay.Day + "&y2=" + today.Year + "&m2=" + today.Month + "&d2=" + today.Day + "&sno=&stt=&sid=&sqt=&sam=&dtype=o&ob=p&pagenum=" + pageIndex);
                                DebugLog(scrap.GetUrl());
                                nextpage = false;
                                for (int line = 2; true; line++)
                                {
                                    if (!scrap.IsElementByXPath("HTML[0]/BODY[1]/DIV[" + divIndex + "]/DIV[1]/DIV[1]/DIV[2]/FORM[1]/TABLE[4]/TBODY[0]/TR[" + line + "]/TD[5]/DIV[0]"))
                                    {
                                        break;
                                    }
                                    nextpage = true;
                                    String value = scrap.GetNodeValueByxPath("HTML[0]/BODY[1]/DIV[" + divIndex + "]/DIV[1]/DIV[1]/DIV[2]/FORM[1]/TABLE[4]/TBODY[0]/TR[" + line + "]/TD[5]/DIV[0]");
                                    value = value.Replace(",", "").Replace("원", "");
                                    sum  += Convert.ToInt32(value);
                                }
                            }
                            LOG.Info("It is scripted  following next: " + dataindex);
                            SetData(dataindex, sum);
                            dataindex++;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                SetEventHandler(ScrapState.ERROR);
                ErrorLog(e.ToString());
            }
        }