/** * @return $this */ protected function processList() { $lines = $this->getFs()->getLines(); $lineNumber = 1; foreach ($lines as $line) { // check web archive limitations: // if website was not blocked by robots.txt rules // or any other WBA Exception if ($lineNumber == 1 && strpos($line, 'Exception') !== false) { $msgArray = explode(':', $line); $error = sprintf('Web Archive Error: %s', array_pop($msgArray)); throw new \RuntimeException($error); } $linkInfo = $this->getApi()->prepareDownloadInfo($line); $content = $this->getApi()->downloadContent($linkInfo['link']); Writer::send(sprintf('%s', $linkInfo['link'])); if ($content === false) { Writer::send(sprintf('Can\'t download resource %s', $linkInfo['link']), 'warning'); } $this->getFs()->saveContent($linkInfo['path'], $content); $lineNumber++; } return $this; }