4 Commits

Author SHA1 Message Date
d5ffdd8699 Ajoute le parser Safti
Fix #20
2021-01-28 17:13:25 +01:00
b3178f046c 📝 Ajoute un README
Fix #18
2020-11-16 14:26:27 +01:00
4b9ca23dff Ajoute le parser Orpi 2020-11-10 12:32:01 +01:00
020cd78822 🐛 Corrige le parsing de l'énergie si vide de Ouest France 2020-11-09 15:36:00 +01:00
4 changed files with 101 additions and 70 deletions

View File

@@ -1,85 +1,46 @@
<p align="center"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></p>
# My Home collection ![language](https://img.shields.io/badge/language-laravel-blue.svg) ![issues](https://img.shields.io/github/issues-raw/Chouchen/Shikiryu_backup) ![ci](https://ci.canhelpme.com/build-status/image/7?branch=main&label=PHPCensor&style=flat-square)
<p align="center">
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://poser.pugx.org/laravel/framework/license.svg" alt="License"></a>
</p>
> Because I need to keep some house in mind
## About Laravel
App to save house sale ads
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
## :books: Table of Contents
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
- [Installation](#package-installation)
- [Usage](#rocket-usage)
- [Support](#hammer_and_wrench-support)
- [Contributing](#memo-contributing)
- [License](#scroll-license)
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## :package: Installation
## Learning Laravel
### Requirements
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
* git
* composer
* yarn or npm
* a database (SQLite, MySQL, …)
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
### Then install this script
## Laravel Sponsors
```sh
git clone https://git.shikiryu.com/Shikiryu/MyHomeCollection.git
composer install
yarn install
```
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
## :rocket: Usage
### Premium Partners
Create an account, add an ad, use the app !
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
## :hammer_and_wrench: Support
### Community Sponsors
Please [open an issue](https://git.shikiryu.com/Shikiryu/MyHomeCollection/issues/new) for support.
<a href="https://op.gg"><img src="http://opgg-static.akamaized.net/icon/t.rectangle.png" width="150"></a>
## :memo: Contributing
- [UserInsights](https://userinsights.com)
- [Fragrantica](https://www.fragrantica.com)
- [SOFTonSOFA](https://softonsofa.com/)
- [User10](https://user10.com)
- [Soumettre.fr](https://soumettre.fr/)
- [CodeBrisk](https://codebrisk.com)
- [1Forge](https://1forge.com)
- [TECPRESSO](https://tecpresso.co.jp/)
- [Runtime Converter](http://runtimeconverter.com/)
- [WebL'Agence](https://weblagence.com/)
- [Invoice Ninja](https://www.invoiceninja.com)
- [iMi digital](https://www.imi-digital.de/)
- [Earthlink](https://www.earthlink.ro/)
- [Steadfast Collective](https://steadfastcollective.com/)
- [We Are The Robots Inc.](https://watr.mx/)
- [Understand.io](https://www.understand.io/)
- [Abdel Elrafa](https://abdelelrafa.com)
- [Hyper Host](https://hyper.host)
- [Appoly](https://www.appoly.co.uk)
- [云软科技](http://www.yunruan.ltd/)
Please contribute using [Github Flow](https://guides.github.com/introduction/flow/). Create a branch, add commits, and [open a pull request](https://github.com/Chouchen/Shikiryu_Backupleonard-henriquez/readme-boilerplateleonard-henriquez/readme-boilerplate/compare/).
## Contributing
## :scroll: License
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
[Creative Commons Attribution NonCommercial (CC-BY-NC)](https://tldrlegal.com/license/creative-commons-attribution-noncommercial-(cc-nc)) © [Chouchen](https://github.com/Chouchen/)

View File

@@ -24,7 +24,8 @@ class OuestFrance extends Parser
$parsedHome->surface = (int)str_replace(' ', '', $details->eq(2)->filter('strong')->text());
$parsedHome->garden_surface = (int)str_replace(' ', '', $details->eq(3)->filter('strong')->text());
$parsedHome->rooms = (int)str_replace(' ', '', $details->eq(4)->filter('strong')->text());
$parsedHome->energy = $crawler->filter('#dpeCateg > strong')->text();
$dpeCateg = $crawler->filter('#dpeCateg > strong');
$parsedHome->energy = $dpeCateg->count() === 1 ? $dpeCateg->text() : '';
// $parsedHome->city = ?
// $parsedHome->map = ?
$parsedHome->pictures = $crawler

67
app/Parser/Safti.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
namespace App\Parser;
use App\ParsedHome;
use App\Parser;
use NumberFormatter;
use Symfony\Component\DomCrawler\Crawler;
class Safti extends Parser
{
/**
* @inheritDoc
*/
public function parse(): ParsedHome
{
$request = $this->client->get($this->url);
$body = $request->getBody()->getContents();
$crawler = new Crawler($body);
$parsed_home = new ParsedHome();
$property_single = $crawler->filter('[data-testid="real-estate"]');
$number_formatter = new NumberFormatter('en', NumberFormatter::DECIMAL);
$currency_formatter = new NumberFormatter('en', NumberFormatter::CURRENCY);
$currency = 'EUR';
$parsed_home->title = $property_single->filter('h1')->text();
$parsed_home->price = $currency_formatter->parseCurrency($property_single->filter('.property__price')->text(), $currency);
$parsed_home->city = $property_single->children()->children('div')->eq(1)->filter('p.h4')->text();
$parsed_home->description = $crawler->filter('[data-testid="real-estate-annonce-single-description"]')->text();
$property__additionals = $crawler->filter('.property__additionals');
$energies = $property__additionals->filter('.energetic-indicator');
if ($energies->count() > 0) {
$parsed_home->energy = substr($energies->eq(0)->text(), 0, 1);
$parsed_home->ges = substr($energies->eq(1)->text(), 0, 1);
}
$crawler
->filter('.property__informations .mobile-extends > div .property__informations__element')
->each(static function (Crawler $property____information, $i) use (&$parsed_home, $number_formatter) {
$name = trim($property____information->filter('i')->text());
$value = trim($property____information->filter('b')->text());
switch ($name) {
case 'Pièces :':
$parsed_home->rooms = (int)$value;
break;
case 'Surface habitable :':
$parsed_home->surface = $number_formatter->parse($value);
break;
case 'Terrain :':
$parsed_home->garden_surface = $number_formatter->parse($value);
break;
default:
// break;
}
});
$parsed_home->pictures = $crawler->filter('[data-testid="real-estate-mosaic-photo"]')->filter('img')->each(static function($img) {
return $img->attr('src');
});
return $parsed_home;
}
}

View File

@@ -6,6 +6,7 @@ use App\Parser\LBC;
use App\Parser\Orpi;
use App\Parser\OuestFrance;
use App\Parser\Pap;
use App\Parser\Safti;
use App\Parser\SeLoger;
return [
@@ -16,6 +17,7 @@ return [
'ouestfrance-immo.com' => OuestFrance::class,
'lannion.immo' => LannionImmo::class,
'immobilier.notaires.fr'=> ImmobilierNotaires::class,
'orpi.com' => Orpi::class
'orpi.com' => Orpi::class,
'safti.fr' => Safti::class,
],
];