<commit_before>## Simple Craigslist API utility
Provides convenient way of getting listing data by various Craigslist filters.

*IMPORTANT NOTE* - This software was developed as an experiment sampling web scraping basics.  Craigslist may prohibit use of automated gathering tools.  Use at your own discretion.

Features
------------
* Get listings by city and category
* Get listings by custom URLs
* Merge sets of listings from multiple requests


Dependency
------------
* [PHP 5.4+] (http://php.net/)
* [PHP Simple HTML Dom Parser] (https://github.com/sunra/php-simple-html-dom-parser)


Installation
------------

Issue following command in console:

```php
composer require andrewevansmith/php-craigslist-api-utility:dev-master
```

Alternatively  edit composer.json by adding following line and run **`composer update`**
```php
"require": { 
    ....,
    "andrewevansmith/php-craigslist-api-utility": "dev-master",
	
},
```

Usage
------------

### Example: making a simple Craigslist request:
```php

    use Craigslist\CraigslistRequest;
    use Craigslist\CraigslistApi;

    $request = new CraigslistRequest([
        'city' => 'louisville',
        'category' => 'pet',
        'query' => 'pup'
    ]);
    $api = new CraigslistApi();
    $result = $api->get($request);
    ....
```

### Example: making a detailed Craigslist request, getting custom fields (photo urls):
```php

    use Craigslist\CraigslistRequest;
    use Craigslist\CraigslistApi;

    $request = new CraigslistRequest([
        'city' => 'louisville',
        'category' => 'pet',
        'query' => 'pup',
        'follow_links' => true,
        'selectors' => [
            [ 'label' => 'photos', 'element' => 'img', 'limit' => 10, 'target' => 'src' ],
        ],
    ]);
    $api = new CraigslistApi();
    $result = $api->get($request);
    ....
```

### Example: making multiple Craigslist requests:
```php

    use Craigslist\CraigslistRequest;
    use Craigslist\CraigslistApi;

    $requests = array( 
        new CraigslistRequest(array(
            'city' => 'louisville',
            'category' => 'pet',
            'query' => 'pup',
            'follow_links' => true,
            'selectors' => array( 
                array('label' => 'photos', 'element' => 'img', 'limit' => 3, 'target' => 'src'),
            )
        )),
        new CraigslistRequest(array(
            'city' => 'lexington',
            'category' => 'pet',
            'query' => 'cat',
            'follow_links' => true,
            'selectors' => array(
                array('label' => 'photos', 'element' => 'img', 'limit' => 3, 'target' => 'src'),
            )
        )),
    ));
    $api = new CraigslistApi();
    $result = $api->get($requests);
    ....
```

Support
-------

[Please open an issue on GitHub](https://github.com/andrewevansmith/php-craigslist-api-utility/issues)


License
-------

This software is released under the MIT License. See the bundled
[LICENSE](https://github.com/andrewevansmith/php-craigslist-api-utility/blob/master/LICENSE)
file for details.<commit_msg>Consistency updates<commit_after>## Simple Craigslist API utility
Provides convenient way of getting listing data by various Craigslist filters.

*IMPORTANT NOTE* - This software was developed as an experiment sampling web scraping basics.  Craigslist may prohibit use of automated gathering tools.  Use at your own discretion.

Features
------------
* Get listings by city and category
* Get listings by custom URLs
* Merge sets of listings from multiple requests


Dependency
------------
* [PHP 5.4+] (http://php.net/)
* [PHP Simple HTML Dom Parser] (https://github.com/sunra/php-simple-html-dom-parser)


Installation
------------

Issue following command in console:

```php
composer require andrewevansmith/php-craigslist-api-utility:dev-master
```

Alternatively  edit composer.json by adding following line and run **`composer update`**
```php
"require": { 
    ....,
    "andrewevansmith/php-craigslist-api-utility": "dev-master",
	
},
```

Usage
------------

### Example: making a simple Craigslist request:
```php

    use Craigslist\CraigslistRequest;
    use Craigslist\CraigslistApi;

    $request = new CraigslistRequest([
        'city' => 'louisville',
        'category' => 'pet',
        'query' => 'pup'
    ]);
    $api = new CraigslistApi();
    $result = $api->get($request);
    ....
```

### Example: making a detailed Craigslist request, getting custom fields (photo urls):
```php

    use Craigslist\CraigslistRequest;
    use Craigslist\CraigslistApi;

    $request = new CraigslistRequest(array(
        'city' => 'louisville',
        'category' => 'pet',
        'query' => 'pup',
        'follow_links' => true,
        'selectors' => array(
            array('label' => 'photos', 'element' => 'img', 'limit' => 10, 'target' => 'src'),
        ),
    ));
    $api = new CraigslistApi();
    $result = $api->get($request);
    ....
```

### Example: making multiple Craigslist requests:
```php

    use Craigslist\CraigslistRequest;
    use Craigslist\CraigslistApi;

    $requests = array( 
        new CraigslistRequest(array(
            'city' => 'louisville',
            'category' => 'pet',
            'query' => 'pup',
            'follow_links' => true,
            'selectors' => array( 
                array('label' => 'photos', 'element' => 'img', 'limit' => 3, 'target' => 'src'),
            )
        )),
        new CraigslistRequest(array(
            'city' => 'lexington',
            'category' => 'pet',
            'query' => 'cat',
            'follow_links' => true,
            'selectors' => array(
                array('label' => 'photos', 'element' => 'img', 'limit' => 3, 'target' => 'src'),
            )
        )),
    );
    $api = new CraigslistApi();
    $result = $api->get($requests);
    ....
```

Support
-------

[Please open an issue on GitHub](https://github.com/andrewevansmith/php-craigslist-api-utility/issues)


License
-------

This software is released under the MIT License. See the bundled
[LICENSE](https://github.com/andrewevansmith/php-craigslist-api-utility/blob/master/LICENSE)
file for details.
{'fraction_non_alphanumeric': 0.16791287386215864, 'fraction_numerical': 0.0019505851755526658, 'mean_word_length': 2.5240549828178693, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 69, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '547927', 'n_tokens_mistral': 1961, 'n_tokens_neox': 1860, 'n_words': 487}