1
0

ViadeoCompany.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. class ViadeoCompany extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "regisenguehard";
  5. $this->name = "Viadeo Company";
  6. $this->uri = "https://www.viadeo.com/";
  7. $this->description = "Returns most recent actus from Company on Viadeo. (http://www.viadeo.com/fr/company/<strong style=\"font-weight:bold;\">apple</strong>)";
  8. $this->update = "2016-08-09";
  9. $this->parameters[] =
  10. '[
  11. {
  12. "name" : "Company name",
  13. "identifier" : "c"
  14. }
  15. ]';
  16. }
  17. public function collectData(array $param){
  18. $html = '';
  19. $link = 'http://www.viadeo.com/fr/company/'.$param[c];
  20. $html = $this->file_get_html($link) or $this->returnError('Could not request Viadeo.', 404);
  21. foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
  22. $title = $element->find('p', 0)->innertext;
  23. if ($title) {
  24. $item = new \Item();
  25. $item->uri = $link;
  26. $item->title = mb_substr($element->find('p', 0)->innertext, 0 ,100);
  27. $item->content = $element->find('p', 0)->innertext;;
  28. $this->items[] = $item;
  29. $i++;
  30. }
  31. }
  32. }
  33. public function getName(){
  34. return 'Viadeo';
  35. }
  36. public function getURI(){
  37. return 'https://www.viadeo.com';
  38. }
  39. public function getCacheDuration(){
  40. return 21600; // 6 hours
  41. }
  42. }