ABCTabsBridge.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * ABCTabsBridge
  4. * Returns the newest tabs
  5. *
  6. * @name ABC Tabs Bridge
  7. * @homepage http://www.abc-tabs.com/
  8. * @description Returns 22 newest tabs
  9. * @maintainer kranack
  10. * @update 2014-07-23
  11. *
  12. */
  13. class ABCTabsBridge extends BridgeAbstract{
  14. private $request;
  15. public function collectData(array $param){
  16. $html = '';
  17. $html = file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404);
  18. $table = $html->find('table#myTable', 0)->children(1);
  19. foreach ($table->find('tr') as $tab)
  20. {
  21. $item = new \Item();
  22. $item->name = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
  23. $item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
  24. $item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
  25. $item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
  26. $item->uri = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
  27. $this->items[] = $item;
  28. }
  29. }
  30. public function getName(){
  31. return 'ABC Tabs Bridge';
  32. }
  33. public function getURI(){
  34. return 'http://www.abc-tabs.com/';
  35. }
  36. public function getCacheDuration(){
  37. return 3600; // 1 hour
  38. }
  39. }