이전 날짜 처리 추가

This commit is contained in:
2016-07-15 01:02:08 +09:00
parent ebcdf9b7ea
commit b35ec4e09a
2 changed files with 165 additions and 150 deletions

297
Form1.Designer.cs generated
View File

@@ -28,160 +28,161 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.lvList = new System.Windows.Forms.ListView(); this.lvList = new System.Windows.Forms.ListView();
this.chTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chTime = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chTitle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chTitle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chCodeName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chCode = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chReference = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chReference = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.chLink = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.chLink = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.wbView = new System.Windows.Forms.WebBrowser(); this.wbView = new System.Windows.Forms.WebBrowser();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.chAutoReload = new System.Windows.Forms.CheckBox(); this.chAutoReload = new System.Windows.Forms.CheckBox();
this.chAutoSelect = new System.Windows.Forms.CheckBox(); this.chAutoSelect = new System.Windows.Forms.CheckBox();
this.tbInterval = new System.Windows.Forms.TextBox(); this.tbInterval = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// lvList // lvList
// //
this.lvList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.chTime, this.chTime,
this.chTitle, this.chTitle,
this.chCodeName, this.chCodeName,
this.chCode, this.chCode,
this.chReference, this.chReference,
this.chLink}); this.chLink});
this.lvList.Dock = System.Windows.Forms.DockStyle.Fill; this.lvList.Dock = System.Windows.Forms.DockStyle.Fill;
this.lvList.FullRowSelect = true; this.lvList.FullRowSelect = true;
this.lvList.GridLines = true; this.lvList.GridLines = true;
this.lvList.Location = new System.Drawing.Point(0, 0); this.lvList.HideSelection = false;
this.lvList.MultiSelect = false; this.lvList.Location = new System.Drawing.Point(0, 0);
this.lvList.Name = "lvList"; this.lvList.MultiSelect = false;
this.lvList.Size = new System.Drawing.Size(864, 157); this.lvList.Name = "lvList";
this.lvList.TabIndex = 0; this.lvList.Size = new System.Drawing.Size(864, 157);
this.lvList.UseCompatibleStateImageBehavior = false; this.lvList.TabIndex = 0;
this.lvList.View = System.Windows.Forms.View.Details; this.lvList.UseCompatibleStateImageBehavior = false;
this.lvList.SelectedIndexChanged += new System.EventHandler(this.lvList_SelectedIndexChanged); this.lvList.View = System.Windows.Forms.View.Details;
// this.lvList.SelectedIndexChanged += new System.EventHandler(this.lvList_SelectedIndexChanged);
// chTime //
// // chTime
this.chTime.Text = "시간"; //
// this.chTime.Text = "시간";
// chTitle //
// // chTitle
this.chTitle.Text = "제목"; //
this.chTitle.Width = 366; this.chTitle.Text = "제목";
// this.chTitle.Width = 366;
// chCodeName //
// // chCodeName
this.chCodeName.Text = "종목명"; //
// this.chCodeName.Text = "종목명";
// chCode //
// // chCode
this.chCode.Text = "종목코드"; //
// this.chCode.Text = "종목코드";
// chReference //
// // chReference
this.chReference.Text = "출처"; //
this.chReference.Width = 72; this.chReference.Text = "출처";
// this.chReference.Width = 72;
// chLink //
// // chLink
this.chLink.Text = "링크"; //
this.chLink.Width = 241; this.chLink.Text = "링크";
// this.chLink.Width = 241;
// wbView //
// // wbView
this.wbView.Dock = System.Windows.Forms.DockStyle.Fill; //
this.wbView.Location = new System.Drawing.Point(0, 0); this.wbView.Dock = System.Windows.Forms.DockStyle.Fill;
this.wbView.MinimumSize = new System.Drawing.Size(20, 20); this.wbView.Location = new System.Drawing.Point(0, 0);
this.wbView.Name = "wbView"; this.wbView.MinimumSize = new System.Drawing.Size(20, 20);
this.wbView.Size = new System.Drawing.Size(864, 644); this.wbView.Name = "wbView";
this.wbView.TabIndex = 1; this.wbView.Size = new System.Drawing.Size(864, 644);
// this.wbView.TabIndex = 1;
// splitContainer1 //
// // splitContainer1
this.splitContainer1.Location = new System.Drawing.Point(0, 25); //
this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Location = new System.Drawing.Point(0, 25);
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; this.splitContainer1.Name = "splitContainer1";
// this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
// splitContainer1.Panel1 //
// // splitContainer1.Panel1
this.splitContainer1.Panel1.Controls.Add(this.lvList); //
// this.splitContainer1.Panel1.Controls.Add(this.lvList);
// splitContainer1.Panel2 //
// // splitContainer1.Panel2
this.splitContainer1.Panel2.Controls.Add(this.wbView); //
this.splitContainer1.Size = new System.Drawing.Size(864, 805); this.splitContainer1.Panel2.Controls.Add(this.wbView);
this.splitContainer1.SplitterDistance = 157; this.splitContainer1.Size = new System.Drawing.Size(864, 805);
this.splitContainer1.TabIndex = 2; this.splitContainer1.SplitterDistance = 157;
// this.splitContainer1.TabIndex = 2;
// chAutoReload //
// // chAutoReload
this.chAutoReload.AutoSize = true; //
this.chAutoReload.Checked = true; this.chAutoReload.AutoSize = true;
this.chAutoReload.CheckState = System.Windows.Forms.CheckState.Checked; this.chAutoReload.Checked = true;
this.chAutoReload.Location = new System.Drawing.Point(3, 4); this.chAutoReload.CheckState = System.Windows.Forms.CheckState.Checked;
this.chAutoReload.Name = "chAutoReload"; this.chAutoReload.Location = new System.Drawing.Point(3, 4);
this.chAutoReload.Size = new System.Drawing.Size(76, 16); this.chAutoReload.Name = "chAutoReload";
this.chAutoReload.TabIndex = 3; this.chAutoReload.Size = new System.Drawing.Size(76, 16);
this.chAutoReload.Text = "자동 갱신"; this.chAutoReload.TabIndex = 3;
this.chAutoReload.UseVisualStyleBackColor = true; this.chAutoReload.Text = "자동 갱신";
// this.chAutoReload.UseVisualStyleBackColor = true;
// chAutoSelect //
// // chAutoSelect
this.chAutoSelect.AutoSize = true; //
this.chAutoSelect.Checked = true; this.chAutoSelect.AutoSize = true;
this.chAutoSelect.CheckState = System.Windows.Forms.CheckState.Checked; this.chAutoSelect.Checked = true;
this.chAutoSelect.Location = new System.Drawing.Point(85, 4); this.chAutoSelect.CheckState = System.Windows.Forms.CheckState.Checked;
this.chAutoSelect.Name = "chAutoSelect"; this.chAutoSelect.Location = new System.Drawing.Point(85, 4);
this.chAutoSelect.Size = new System.Drawing.Size(76, 16); this.chAutoSelect.Name = "chAutoSelect";
this.chAutoSelect.TabIndex = 4; this.chAutoSelect.Size = new System.Drawing.Size(76, 16);
this.chAutoSelect.Text = "자동 선택"; this.chAutoSelect.TabIndex = 4;
this.chAutoSelect.UseVisualStyleBackColor = true; this.chAutoSelect.Text = "자동 선택";
// this.chAutoSelect.UseVisualStyleBackColor = true;
// tbInterval //
// // tbInterval
this.tbInterval.Location = new System.Drawing.Point(226, 2); //
this.tbInterval.Name = "tbInterval"; this.tbInterval.Location = new System.Drawing.Point(226, 2);
this.tbInterval.Size = new System.Drawing.Size(42, 21); this.tbInterval.Name = "tbInterval";
this.tbInterval.TabIndex = 5; this.tbInterval.Size = new System.Drawing.Size(42, 21);
this.tbInterval.Text = "0.5초"; this.tbInterval.TabIndex = 5;
this.tbInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.tbInterval.Text = "0.5초";
this.tbInterval.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbInterval_KeyPress); this.tbInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
// this.tbInterval.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbInterval_KeyPress);
// label1 //
// // label1
this.label1.AutoSize = true; //
this.label1.Location = new System.Drawing.Point(167, 5); this.label1.AutoSize = true;
this.label1.Name = "label1"; this.label1.Location = new System.Drawing.Point(167, 5);
this.label1.Size = new System.Drawing.Size(53, 12); this.label1.Name = "label1";
this.label1.TabIndex = 6; this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.Text = "갱신주기"; this.label1.TabIndex = 6;
// this.label1.Text = "갱신주기";
// Form1 //
// // Form1
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.ClientSize = new System.Drawing.Size(864, 829); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1); this.ClientSize = new System.Drawing.Size(864, 829);
this.Controls.Add(this.tbInterval); this.Controls.Add(this.label1);
this.Controls.Add(this.chAutoSelect); this.Controls.Add(this.tbInterval);
this.Controls.Add(this.chAutoReload); this.Controls.Add(this.chAutoSelect);
this.Controls.Add(this.splitContainer1); this.Controls.Add(this.chAutoReload);
this.Name = "Form1"; this.Controls.Add(this.splitContainer1);
this.Text = "News Crawler"; this.Name = "Form1";
this.splitContainer1.Panel1.ResumeLayout(false); this.Text = "News Crawler";
this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.ResumeLayout(false); this.splitContainer1.ResumeLayout(false);
this.PerformLayout(); this.ResumeLayout(false);
this.PerformLayout();
} }

View File

@@ -72,7 +72,15 @@ namespace NewsCrawler
string strTime = item.SelectSingleNode(".//span").InnerText; string strTime = item.SelectSingleNode(".//span").InnerText;
string strURL = strServerURL+item.SelectSingleNode(".//a").GetAttributeValue("href", ""); string strURL = strServerURL+item.SelectSingleNode(".//a").GetAttributeValue("href", "");
if(m_ItemList.Any(c => c.m_strURL==strURL)==false)
if (Regex.IsMatch(strTime, @"\d+/\d+") == true)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
if (m_ItemList.Any(c => c.m_strURL==strURL)==false)
{ {
NEWS_ITEM news = new NEWS_ITEM(); NEWS_ITEM news = new NEWS_ITEM();
news.m_strTitle=strTitle; news.m_strTitle=strTitle;
@@ -119,7 +127,13 @@ namespace NewsCrawler
string strURL = item.SelectSingleNode(".//a").GetAttributeValue("href", ""); string strURL = item.SelectSingleNode(".//a").GetAttributeValue("href", "");
strURL = "http://www.etoday.co.kr/news/section/newsview.php?idxno="+Regex.Replace(strURL, @"\D", ""); strURL = "http://www.etoday.co.kr/news/section/newsview.php?idxno="+Regex.Replace(strURL, @"\D", "");
if(m_ItemList.Any(c => c.m_strURL==strURL)==false) if (Regex.IsMatch(strTime, @"\d+/\d+") == true)
{
//Console.WriteLine("어제 기사 : " + item.InnerHtml);
continue;
}
if (m_ItemList.Any(c => c.m_strURL==strURL)==false)
{ {
NEWS_ITEM news = new NEWS_ITEM(); NEWS_ITEM news = new NEWS_ITEM();
news.m_strTitle=strTitle; news.m_strTitle=strTitle;