Skip to content

Commit 58ea7ba

Browse files
committed
루리웹 크롤러 예외 처리
1 parent 648eed4 commit 58ea7ba

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

Cli/Program.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ private static async Task Main(string[] args)
2121
var client = new MongoClient("mongodb://localhost:27017/?maxPoolSize=200");
2222
var database = client.GetDatabase("cli-web-crawler");
2323

24+
await new RuliwebCrawler(null, database, new WebCrawler.Models.Source
25+
{
26+
Type = CrawlingType.Ruliweb,
27+
BoardId = "market/board/1003",
28+
Name = "콘솔뉴스"
29+
}).RunAsync();
2430

2531
await new RuliwebCrawler(null, database, new WebCrawler.Models.Source
2632
{
@@ -91,13 +97,6 @@ private static async Task Main(string[] args)
9197
BoardId = "market/board/1020",
9298
Name = "핫딜게시판"
9399
}).RunAsync();
94-
95-
await new RuliwebCrawler(null, database, new WebCrawler.Models.Source
96-
{
97-
Type = CrawlingType.Ruliweb,
98-
BoardId = "market/board/1003",
99-
Name = "콘솔뉴스"
100-
}).RunAsync();
101100

102101
await new FmkoreaCrawler(null, database, new WebCrawler.Models.Source
103102
{

WebCrawler/Crawler/RuliwebCrawler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected override void OnPageCrawl(IDocument document)
111111
.ToList();
112112

113113
var tdContent = document.QuerySelectorAll("tbody tr")
114-
.Where(x => x.ClassName.Contains("table_body"))
114+
.Where(x => x.ClassName.Contains("table_body") && x.ClassName.Contains("blocktarget") && !string.IsNullOrEmpty(x.TextContent))
115115
.SelectMany(x => x.QuerySelectorAll("td")
116116
.Select(cell =>
117117
{

0 commit comments

Comments
 (0)