ABCTabsBridge.php 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class ABCTabsBridge extends BridgeAbstract{
  3. private $request;
  4. public function loadMetadatas() {
  5. $this->maintainer = "kranack";
  6. $this->name = "ABC Tabs Bridge";
  7. $this->uri = "http://www.abc-tabs.com/";
  8. $this->description = "Returns 22 newest tabs";
  9. }
  10. public function collectData(array $param){
  11. $html = '';
  12. $html = $this->getSimpleHTMLDOM('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnClientError('No results for this query.');
  13. $table = $html->find('table#myTable', 0)->children(1);
  14. foreach ($table->find('tr') as $tab)
  15. {
  16. $item = array();
  17. $item['author'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
  18. $item['title'] = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
  19. $item['content'] = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
  20. $item['id'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
  21. $item['uri'] = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
  22. $this->items[] = $item;
  23. }
  24. }
  25. }