Skip to content

Commit

Permalink
Merge pull request #5 from Laurentvw/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Laurentvw committed Apr 29, 2015
2 parents a14b63d + 7167d1c commit 23d5c37
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ In some cases, you may want to add (read: append) URLs or contents on the fly.

```php
$scrapher->addUrl($url);
$scrapher->addUrls([$url, $url2]);
$scrapher->addUrls(array($url, $url2));
$scrapher->addContent($content);
$scrapher->addContents([$content, $content2]);
$scrapher->addContents(array($content, $content2));
```

### Matching data using a Selector
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "laurentvw/scrapher",
"type": "library",
"description": "A PHP library to easily scrape data from web pages",
"description": "A web scraper for PHP to easily extract data from web pages",
"keywords": ["scraper", "scraping", "scrape", "extract", "extractor", "crawler", "crawling", "match", "matcher", "parse", "parser", "data", "mining", "harvest", "text", "content", "spider"],
"homepage": "http://github.com/Laurentvw/scrapher",
"require": {
"php": ">=5.4.0"
"php": ">=5.3.0"
},
"license": "MIT",
"authors": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php namespace Laurentvw\Scrapher\Exceptions;

class SelectorNotFoundException extends \Exception {

public function __construct()
{
parent::__construct('No selector was specified using the with() method');
}
}
7 changes: 7 additions & 0 deletions src/Laurentvw/Scrapher/Scrapher.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Laurentvw\Scrapher;

use Laurentvw\Scrapher\Exceptions\ContentNotFoundException;
use Laurentvw\Scrapher\Exceptions\SelectorNotFoundException;
use Laurentvw\Scrapher\Selectors\Selector;

class Scrapher {
Expand Down Expand Up @@ -255,9 +256,15 @@ public function getLogs()
* The matcher
*
* @return Matcher
* @throws SelectorNotFoundException
*/
protected function getMatcher()
{
if ( ! $this->matcher)
{
throw new SelectorNotFoundException;
}

return $this->matcher;
}

Expand Down

0 comments on commit 23d5c37

Please sign in to comment.