ABCTabsBridge.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. $this->update = "2014-07-23";
  10. }
  11. public function collectData(array $param){
  12. $html = '';
  13. $html = $this->file_get_html('http://www.abc-tabs.com/tablatures/nouveautes.html') or $this->returnError('No results for this query.', 404);
  14. $table = $html->find('table#myTable', 0)->children(1);
  15. foreach ($table->find('tr') as $tab)
  16. {
  17. $item = new \Item();
  18. $item->name = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
  19. $item->title = $tab->find('td', 1)->plaintext . ' - ' . $tab->find('td', 2)->plaintext;
  20. $item->content = 'Le ' . $tab->find('td', 0)->plaintext . '<br> Par: ' . $tab->find('td', 5)->plaintext . '<br> Type: ' . $tab->find('td', 3)->plaintext;
  21. $item->id = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
  22. $item->uri = 'http://www.abc-tabs.com' . $tab->find('td', 2)->find('a', 0)->getAttribute('href');
  23. $this->items[] = $item;
  24. }
  25. }
  26. public function getName() {
  27. return "ABC Tabs Bridge";
  28. }
  29. public function getURI() {
  30. return "http://www.abc-tabs.com/";
  31. }
  32. public function getCacheDuration(){
  33. return 3600; // 1 hour
  34. }
  35. }