Skip to content

Commit

Permalink
Fix single pages categories
Browse files Browse the repository at this point in the history
  • Loading branch information
Lustyn committed Jan 14, 2018
1 parent 7105c4b commit ce702f7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Scraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class Scraper

public async static void Scrape(int category, int page)
{
if(page == 1)
{
Reset();
}
try
{
Browser.AllowAutoRedirect = true;
Expand Down Expand Up @@ -62,7 +66,7 @@ public async static void Scrape(int category, int page)

foreach(HtmlNode node in htmlNodes)
{
if(node.SelectNodes("a").Count() > 0)
if(node.SelectNodes("a") != null)
{
foreach (HtmlNode aNode in node.SelectNodes("a"))
{
Expand Down Expand Up @@ -104,5 +108,12 @@ public async static void Scrape(int category, int page)
Console.WriteLine(e);
}
}

public static void Reset()
{
totalPages = 0;
itemsScraped = 0;
pagesScraped = 0;
}
}
}

0 comments on commit ce702f7

Please sign in to comment.