버그 수정
This commit is contained in:
35
Crawler.cs
35
Crawler.cs
@@ -20,6 +20,8 @@ namespace NewsCrawler
|
||||
public Crawler(NewsForm Listener)
|
||||
{
|
||||
m_Listener = Listener;
|
||||
|
||||
Test();
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +35,14 @@ namespace NewsCrawler
|
||||
public string m_strAuthKey = "";
|
||||
};
|
||||
|
||||
void Test()
|
||||
{
|
||||
if(Util.IsDebugging() == false)
|
||||
return;
|
||||
|
||||
ReadSupplyContract(false, "강스템바이오텍", "http://m.dart.fss.or.kr/viewer/main.st?rcpNo=20170111900149");
|
||||
}
|
||||
|
||||
void ResponseAsiaE(IAsyncResult result)
|
||||
{
|
||||
REQUEST_STATUS State = (REQUEST_STATUS)result.AsyncState;
|
||||
@@ -850,18 +860,25 @@ namespace NewsCrawler
|
||||
string strXPath = "//div[@class='categoryList']//li";
|
||||
|
||||
var lists = doc.DocumentNode.SelectNodes(strXPath);
|
||||
foreach(var item in lists)
|
||||
try
|
||||
{
|
||||
string strTitle = item.SelectNodes(".//a")[1].InnerText;
|
||||
string strDateTime = item.SelectSingleNode(".//span[@class='category_date']").InnerText;
|
||||
string strURL = strServerURL+item.SelectNodes(".//a")[1].GetAttributeValue("href", "");
|
||||
foreach(var item in lists)
|
||||
{
|
||||
string strTitle = item.SelectNodes(".//a")[1].InnerText;
|
||||
string strDateTime = item.SelectSingleNode(".//span[@class='category_date']").InnerText;
|
||||
string strURL = strServerURL+item.SelectNodes(".//a")[1].GetAttributeValue("href", "");
|
||||
|
||||
DateTime Time;
|
||||
DateTime.TryParseExact(strDateTime, "yyyy.MM.dd HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time);
|
||||
if(Time.DayOfYear < m_Today.DayOfYear)
|
||||
break;
|
||||
DateTime Time;
|
||||
DateTime.TryParseExact(strDateTime, "yyyy.MM.dd HH:mm", CultureInfo.CurrentCulture, DateTimeStyles.None, out Time);
|
||||
if(Time.DayOfYear < m_Today.DayOfYear)
|
||||
break;
|
||||
|
||||
m_Listener.InsertItem(strTitle, "", "", Time, DateTime.Now, strURL, "파이낸셜뉴스", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
|
||||
m_Listener.InsertItem(strTitle, "", "", Time, DateTime.Now, strURL, "파이낸셜뉴스", State.m_Timer.Elapsed.TotalMilliseconds, bInitial);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user