forked from blallo/rss-bridge
LeBonCoinBridge fixed.
This commit is contained in:
parent
99b7d2e6b4
commit
88a78b5666
1 changed files with 26 additions and 20 deletions
|
@ -137,30 +137,36 @@ class LeBonCoinBridge extends BridgeAbstract{
|
||||||
$link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']);
|
$link = 'http://www.leboncoin.fr/annonces/offres/' . $param['r'] . '/?f=a&th=1&q=' . urlencode($param['k']);
|
||||||
$html = file_get_html($link) or $this->returnError('Could not request LeBonCoin.', 404);
|
$html = file_get_html($link) or $this->returnError('Could not request LeBonCoin.', 404);
|
||||||
|
|
||||||
$list = $html->find('.list-lbc', 0);
|
$list = $html->find('.tabsContent', 0);
|
||||||
if($list === NULL) {
|
if($list === NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$tags = $list->find('a');
|
|
||||||
|
$tags = $list->find('li');
|
||||||
|
|
||||||
foreach($tags as $element) {
|
foreach($tags as $element) {
|
||||||
|
|
||||||
|
$element = $element->find('a', 0);
|
||||||
|
|
||||||
$item = new \Item();
|
$item = new \Item();
|
||||||
$item->uri = $element->href;
|
$item->uri = $element->href;
|
||||||
$title = $element->getAttribute('title');
|
$title = $element->getAttribute('title');
|
||||||
$content_image = $element->find('div.image', 0)->find('img', 0);
|
$content_image = $element->find('div.item_image', 0)->find('.lazyload', 0);
|
||||||
|
|
||||||
if($content_image !== NULL) {
|
if($content_image !== NULL) {
|
||||||
$content = '<img src="' . $element->find('div.image', 0)->find('img', 0)->getAttribute('src') . '" alt="thumbnail">';
|
$content = '<img src="' . $content_image->getAttribute('data-imgsrc') . '" alt="thumbnail">';
|
||||||
|
} else {
|
||||||
|
$content = "";
|
||||||
}
|
}
|
||||||
$date = $element->find('div.date', 0)->find('div', 0) . $element->find('div.date', 0)->find('div', 1) . '<br/>';
|
$date = $element->find('aside.item_absolute', 0)->find('p.item_sup', 0);
|
||||||
$detailsList = $element->find('div.detail', 0);
|
|
||||||
|
|
||||||
for ($i = 1; $i < 4; $i++) {
|
$detailsList = $element->find('section.item_infos', 0);
|
||||||
$line = $detailsList->find('div', $i);
|
|
||||||
$content .= $line;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->title = $title . ' - ' . $detailsList->find('div', 3);
|
for($i = 0; $i <= 1; $i++) $content .= $detailsList->find('p.item_supp', $i)->plaintext;
|
||||||
|
$price = $detailsList->find('h3.item_price', 0);
|
||||||
|
$content .= $price === NULL ? '' : $price->plaintext;
|
||||||
|
|
||||||
|
$item->title = $title;
|
||||||
$item->content = $content . $date;
|
$item->content = $content . $date;
|
||||||
$this->items[] = $item;
|
$this->items[] = $item;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue