2014-07-23 13:11:55 +02:00
|
|
|
<?php
|
|
|
|
class ABCTabsBridge extends BridgeAbstract{
|
2015-11-03 23:28:44 +01:00
|
|
|
|
2014-07-23 13:11:55 +02:00
|
|
|
private $request;
|
2015-11-03 23:28:44 +01:00
|
|
|
|
|
|
|
public function loadMetadatas() {
|
|
|
|
|
|
|
|
$this->maintainer = "kranack";
|
|
|
|
$this->name = "ABC Tabs Bridge";
|
|
|
|
$this->uri = "http://www.abc-tabs.com/";
|
|
|
|
$this->description = "Returns 22 newest tabs";
|
2016-08-09 14:54:44 +02:00
|
|
|
$this->update = "2016-08-09";
|
2015-11-03 23:28:44 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-07-23 13:11:55 +02:00
|
|
|
public function collectData(array $param){
|
|
|
|
$html = '';
|
2016-06-25 23:17:42 +02:00
|
|
|
$html = $this->file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404);
|
2014-07-23 13:11:55 +02:00
|
|
|
$table = $html->find('table#myTable', 0)->children(1);
|
|
|
|
|
|
|
|
foreach ($table->find('tr') as $tab)
|
|
|
|
{
|
|
|
|
$item = new \Item();
|
2016-08-09 14:54:44 +02:00
|
|
|
$item->author = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
|
2014-07-23 13:11:55 +02:00
|
|
|
$item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
|
|
|
|
$item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
|
|
|
|
$item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
|
|
|
|
$item->uri = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
|
|
|
|
$this->items[] = $item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|