From 5714892115640d03c2d6a02c5ce96f2ac9b31e9a Mon Sep 17 00:00:00 2001 From: 16mhz Date: Tue, 22 Jul 2014 17:20:43 +0200 Subject: [PATCH] Add: New bridge for LeBonCoin with region filter --- bridges/LeBonCoinBridge.php | 61 +++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 bridges/LeBonCoinBridge.php diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php new file mode 100755 index 00000000..e895bc2c --- /dev/null +++ b/bridges/LeBonCoinBridge.php @@ -0,0 +1,61 @@ +returnError('Could not request LeBonCoin.', 404); + + $list = $html->find('.list-lbc', 0); + $tags = $list->find('a'); + + foreach($tags as $element) { + $item = new \Item(); + $item->uri = $element->href; + $title = $element->getAttribute('title'); + + $content = 'thumbnail'; + $date = $element->find('div.date', 0)->find('div', 0) . $element->find('div.date', 0)->find('div', 1) . '
'; + $detailsList = $element->find('div.detail', 0); + + for ($i = 1; $i < 4; $i++) { + $line = $detailsList->find('div', $i); + $content .= $line; + } + + $item->title = $title . ' - ' . $detailsList->find('div', 3); + $item->content = $content . $date; + $this->items[] = $item; + } + } + + public function getName(){ + return 'LeBonCoin'; + } + + public function getURI(){ + return 'http://www.leboncoin.fr'; + } + + public function getCacheDuration(){ + return 3600; // 1 hour + } +}