ABCTabsBridge.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 = "2016-08-09";
  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->author = $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. }