fixed counter

This commit is contained in:
Sem van der Hoeven
2020-03-03 17:39:42 +01:00
parent a922615e96
commit 9946dc9d12

View File

@@ -71,7 +71,7 @@ public class WebCrawler {
* @param searchWord the word to search for * @param searchWord the word to search for
*/ */
public void search(String url, String searchWord) { public void search(String url, String searchWord) {
int counter = 1; int counter = 0;
while (this.pagesVisited.size() < amountOfPages) { while (this.pagesVisited.size() < amountOfPages) {
String curUrl; String curUrl;
CrawlBranch branch = new CrawlBranch(); CrawlBranch branch = new CrawlBranch();
@@ -80,8 +80,8 @@ public class WebCrawler {
this.pagesVisited.add(url); this.pagesVisited.add(url);
} else { } else {
curUrl = this.nextUrl(); curUrl = this.nextUrl();
System.out.println(String.format("visiting page %s / %s",counter,amountOfPages));
counter++; counter++;
System.out.println(String.format("visiting page %s / %s",counter,amountOfPages));
} }
branch.crawl(curUrl); branch.crawl(curUrl);