dev-master
9999999-devA (very) simple URL scraper that fetches title, description and images.
The Requires
- php >=5.3.0
- illuminate/support 4.1.*
by Negative
Wallogit.com
2017 © Pedro Peláez
A (very) simple URL scraper that fetches title, description and images.
A (very) simple URL scraper that fetches title, description and images., (*2)
Install via Composer, (*3)
composer require negative\simplescraper
version: dev-master., (*4)
Add, (*5)
'Negative\Simplescraper\SimplescraperServiceProvider'
to your app/config.php $providers array, (*6)
Please check vendor/negative/simplescraper/src/config/config.php for configuration options., (*7)
Publish the configuration file by running, (*8)
php artisan config:publish negative/simplescraper
and edit the configuration file under, (*9)
/app/config/packages/negative/simplescraper/config.php
That's about it., (*10)
Simply call:, (*11)
Simplescraper::lookup('http://www.ikea.com/us/en/catalog/products/60202199/');
It will return an array like this:, (*12)
array(
"url" => "http://www.ikea.com/us/en/catalog/products/60202199/",
"title" => "FALSTER Table - gray - IKEA",
"description" => "IKEA - FALSTER, Table, gray , Polystyrene slats are weather-resistant and easy to care for.The furniture is both sturdy and lightweight as the frame is made of rustproof aluminum.You can easily sand down light scratches on the slates with fine sandpaper.",
"images" => ["uploads/simplescraper/5329acc4378bb.jpg"]
)
The config allows for the following options:, (*13)
// If defined, download the scraped images to this directory // PLEASE NOTE: use a dedicated folder if you want to use download_ttl 'download_dir' => public_path().'/uploads/simplescraper/', // Delete downloded images after (seconds) // set to zero to prevent automatic cleanup 'download_ttl' => 120, // The maximum number of images to download 'max_imgs' => 1, // Set a minimum size for the images that are shown. This requires // a download_dir to be set. 'minimum_size' => '300x200'
Inspired by the Laraval 3 bundle Scrapey https://github.com/BKWLD/scrapey ., (*14)
A (very) simple URL scraper that fetches title, description and images.