Skip to content

Commit

Permalink
[Debug] ProgressBar
Browse files Browse the repository at this point in the history
  • Loading branch information
Mediashare committed Apr 13, 2020
1 parent c603b09 commit 8eebb2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public function run() {
public function scrape(string $url): Scraper {
$scraper = new Scraper($url);
$scraper->run();
$this->progressBar($url); // Output ProgressBar
// Modules
$modules = $this->modules($scraper);
$this->modules[$url] = $modules;
// Add new urls in the wait list
$this->newUrls($scraper);
$this->urls[(string) $url] = $scraper; // Record Scraper
unset($this->wait[(string) $url]); // Remove url to the list
$this->progressBar($url); // Output ProgressBar
// Modules
$modules = $this->modules($scraper);
$this->modules[$url] = $modules;
return $scraper;
}

Expand Down Expand Up @@ -113,7 +113,7 @@ private function progressBar(string $url) {
$climate = new CLImate();
$counter = count($this->urls);
$max_counter = 1;
if ($this->config->getWebspider()):
if ($this->config->getWebspider() && \count($this->wait) > 0):
$max_counter = $counter + \count($this->wait);
endif;
$message = "(".$counter."/".$max_counter.") [".$url."]";
Expand Down

0 comments on commit 8eebb2d

Please sign in to comment.