Beispiel #1
0
 private void not_keyword_del_btn_Click(object sender, EventArgs e)
 {
     if (not_keyword_list.SelectedItem != null)
     {
         not_keyword_list.Items.Remove(not_keyword_list.SelectedItem);
     }
     else
     {
         MessageBoxs.Show("삭제할 키워드를 선택 해주세요.", "", "확인");
     }
 }
Beispiel #2
0
 private void not_keyword_add_btn_Click(object sender, EventArgs e)
 {
     if (not_keyword_input.Text == "")
     {
         MessageBoxs.Show("키워드를 입력하세요.", "msg", "확인");
     }
     else
     {
         this.not_keyword_list.Items.Add(not_keyword_input.Text);
         not_keyword_input.Text = "";
         not_keyword_input.Focus();
     }
 }
Beispiel #3
0
        //===============================================================================================
        // 이제부터 추출기능 시작!
        //===============================================================================================

        /*private WebRequest request;
         * private HttpWebResponse response;
         * private HtmlAgilityPack.HtmlDocument doc;
         * private Stream dataStream;*/

        //대상 키워드, 제외 키워드 수집 후, 실제 추출 함수로 이동.
        private void button1_Click(object sender, EventArgs e)
        {
            emali_list1.Items.Clear();

            isPause     = false;
            keyword_num = 0;
            url_n       = 0;

            if (loop_check.Checked)
            {
                count_timer = Convert.ToInt32(Regex.Replace(Minute_unit.SelectedItem.ToString(), @"\D", "")) * 60;
            }
            else
            {
                count_timer = 0;
            }

            if (keyword_list.Items.Count <= 0)
            {
                MessageBoxs.Show("키워드를 추가 해주세요.", "msg", "확인");
                return;
            }

            array_AList.Clear();
            //대상키워드
            for (int k = 0; k < keyword_list.Items.Count; k++)
            {
                array_AList.Add(keyword_list.Items[k].ToString());
            }

            array_No_AList.Clear();
            //제외 키워드 가져오기
            for (int k = 0; k < not_keyword_list.Items.Count; k++)
            {
                array_No_AList.Add(not_keyword_list.Items[k].ToString());
            }

            stop_btn.Enabled = true;
            crol_btn.Enabled = false;

            //m_thread =new Thread(new ThreadStart(search_blog));
            //m_thread.Name = "keyword";
            //m_thread.IsBackground = true;
            //m_thread.Start();

            search_blog();
            //this.worker = new Thread(new ThreadStart(this.search_blog));
            //this.worker.Start();
        }
Beispiel #4
0
 private void button4_Click(object sender, EventArgs e)
 {
     save_type = "text";
     if (emali_list1.Items.Count > 0)
     {
         //File_Save.Loading("엑셀",emali_list);
         using (frm = new File_Save(SaveData))
         {
             frm.label2.Text          = "텍스트로 다운중...";
             frm.progressBar1.Style   = ProgressBarStyle.Continuous;
             frm.progressBar1.Minimum = 0;
             frm.progressBar1.Maximum = emali_list1.Items.Count;
             frm.progressBar1.Step    = 1;
             frm.progressBar1.Value   = 0;
             frm.ShowDialog(this);
         }
     }
     else
     {
         MessageBoxs.Show("추출결과가 없습니다.", "", "확인");
     }
 }
Beispiel #5
0
        //실제 추출 함수
        private void search_blog()
        {
            loading_gif.Visible  = true;
            Loading_txt2.Visible = true;

            ArrayList doc_text       = new ArrayList();
            ArrayList title_doc_text = new ArrayList();

            progressBar.Style   = ProgressBarStyle.Continuous;
            progressBar.Minimum = 0;
            progressBar.Step    = 1;
            progressBar.Value   = 0;
            Application.DoEvents();
            //if (array_AList.Count < keyword_num) return;
            //MessageBox.Show(array_AList.Count.ToString()+" "+keyword_num.ToString());
            //네이버 검색 api
            string query = array_AList[keyword_num].ToString(); // 검색할 키워드

            now_keyword = array_AList[keyword_num].ToString();
            //sort=sim, date
            Application.DoEvents();
            string sort = "sim";

            if (new_order.Checked)
            {
                sort = "date";
            }
            else if (accuracy_order.Checked)
            {
                sort = "sim";
            }
            while (isPause)
            {
                Application.DoEvents();
                Thread.Sleep(1);
            }

            string url = "https://openapi.naver.com/v1/search/blog.json?query=" + query + "&display=" + page_num.Text + "&sort=" + sort; // 결과가 JSON 포맷

            Application.DoEvents();                                                                                                      // string url = "https://openapi.naver.com/v1/search/blog.xml?query=" + query;  // 결과가 XML 포맷
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.Headers.Add("X-Naver-Client-Id", "sJ0znk4nPpAoS7g7Ojg7"); // 클라이언트 아이디
            request.Headers.Add("X-Naver-Client-Secret", "YC1NEpPYnO");       // 클라이언트 시크릿
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            string          status   = response.StatusCode.ToString();

            if (status == "OK")
            {
                Application.DoEvents();
                Stream       stream = response.GetResponseStream();
                StreamReader reader = new StreamReader(stream, Encoding.UTF8);
                string       text   = reader.ReadToEnd();
                //Log.Show(text);

                JObject rss        = JObject.Parse(text);
                var     totalCount = Convert.ToInt32(rss["total"]);
                doc_text.Clear();
                title_doc_text.Clear();
                urls.Clear();
                if (totalCount > 0)
                {
                    int line = 0;

                    foreach (var item in rss["items"])
                    {
                        Application.DoEvents();
                        doc_text.Add(rss["items"][line]["link"].ToString().Replace("amp;", ""));
                        title_doc_text.Add(rss["items"][line]["title"].ToString());
                        line++;
                    }
                    //Log.Show(doc_text.Count+""+doc_text[0]);
                    Application.DoEvents();

                    //String test = "";
                    for (int i = 0; i < doc_text.Count; i++)
                    {
                        Application.DoEvents();
                        //제외 키워드
                        int isNotKeyword = 0;
                        if (not_keyword_list.Items.Count > 0)
                        {
                            for (int nk = 0; nk < not_keyword_list.Items.Count; nk++)
                            {
                                Application.DoEvents();
                                if (title_doc_text[i].ToString().Contains(not_keyword_list.Items[nk].ToString()))
                                {
                                    isNotKeyword = 1;
                                    break;
                                }
                            }
                        }
                        if (isNotKeyword == 0)
                        {
                            urls.Add(doc_text[i]);
                        }
                        //test += doc_text[i]+"\r\n";
                    }
                    progressBar.Maximum = urls.Count;
                    //MessageBoxs.Show(urls.Count.ToString(),"","확인");
                    //Log.Show(urls.Count.ToString());
                }
                else
                {
                    MessageBoxs.Show("검색결과가 없습니다.", "MSG", "확인");
                }
            }
            else
            {
                MessageBoxs.Show("Error 발생=" + status, "MGS", "확인");
            }
            while (isPause)
            {
                Application.DoEvents();
                Thread.Sleep(1);
            }
            //블로그 추출 시작
            web_loop(url_n);
        }