2017 © Pedro Peláez
 

library dubizzle

Dubizzle for PHP

image

osoobe/dubizzle

Dubizzle for PHP

  • Sunday, November 22, 2015
  • by b4oshany
  • Repository
  • 2 Watchers
  • 3 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

Introduction

Dubizzle is an online classifieds website. This project aims to become a simple and complete PHP scraping-based API for Dubizzle., (*1)

This project was enspired by python's Dubizzle scraping API., (*2)

Notice

This is still a work in progress. There is much left to do until this becomes what it should be. I will however make sure that the master branch functions as expected. Any help would be greatly appreciated, obviously., (*3)

Another thing to point out is that the main focus for the time being is on Dubizzle UAE and specifically Motors search within it., (*4)

Prerequisites

Installation

To easily install Dubizzle, simply:, (*5)

composer require osoobe/dubizzle

If you don't have compose install, see how to install and use composer, (*6)

Quickstart


use Dubizzle\Search; $params = ["country"=>'uae', "city"=>"dubai", "section"=>"motor"]; $uea = new Search($params); $query = $uea->search(); $query->fetch(); $results = $query->get_results();

The $results variable is a array of associated data for each result item on dubizzle:, (*7)


var_dump($results); [ ['title' => '...', 'location' => '...', 'url' => '...', 'price' => '...', 'category' => '...' ], ['title' => '...', 'location' => '...', 'url' => '...', 'price' => '...', 'category' => '...' ], ... ]

See Demo 1 for data output., (*8)

Example

Find average price of year 2007 and above Nissan Altimas in Dubai (Live Demo), (*9)

require_once "../vendor/autoload.php";

use Dubizzle\Search;

$params = [
    "keyword"=>'altima',
    "country"=>'uae',
    "city"=>'dubai',
    "section"=>'motors',
    "category"=>'cars',
    "make"=>'nissan',
    "min_year"=>2007,
    "num_results"=>'all'];

$uae = new Search($params);

$query = $uae->search();
$query->fetch();
$results = $query->get_results();

$result_count = count($results);
$total_price = 0;
foreach($results as $result){
    $total_price += $result["price"];
}

echo "Num. Results:   ".$result_count;
echo "<br/>";
echo "<br/>";
echo "Average price:  ".(intval($total_price / $result_count)); # Prints 39239.94

Other Examples

Get the list of makes from [Dubizzle] (Live Demo):, (*10)


use Dubizzle\Category; $category = new Category(); $makes = $category->get_makes(Category::$uae["categories"]["options"]['cars']);

Get the list of models from [Dubizzle] (Live Demo):, (*11)


use Dubizzle\Category; $category = new Category(); $models = $category->get_models(Category::$uae["makes"]["options"]['audi']);

Search Parameters

General

  • country - string; defaults to 'uae'
  • keyword - string
  • city - string
  • section - string
  • min_price and max_price - integers
  • category - string
  • added_days - choices are 0, 3, 7, 14, 30, 90, or 180
  • num_results - integer; 'all' fetches all results available
  • detailed (not implemented) - if set to True, fetches full listing data for each result; slower, obviously

Motors

  • make - a long list can be found in regions.py
  • min_year and max_year - integers
  • min_kms and max_kms - integers
  • seller - 'dealer' or 'owner'
  • fuel - 'gasoline', 'hybrid', 'diesel', or 'electric'
  • cylinders - 3, 4, 5, 6, 8, 10, or 12
  • transmission - 'automatic' or 'manual'

Listing Parameters

  • url - string, required
  • country - string; defaults to 'uae'

Issues

Please use the Issues page for that., (*12)

The Versions

22/11 2015
14/11 2015
04/11 2015
03/09 2015

v1.1

1.1.0.0 https://github.com/Osoobe/dubizzle-php

Dubizzle for PHP

  Sources   Download

MIT

The Requires

 

php screen scraper dubizzle

30/08 2015

v1.0

1.0.0.0 https://github.com/Osoobe/dubizzle-php

Dubizzle for PHP

  Sources   Download

MIT

The Requires

 

php screen scraper dubizzle