Created
January 18, 2015 18:07
-
-
Save sleeping-owl/b9b74262159daec99d94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RestoclubApi extends Apist | |
{ | |
public function getBaseUrl() | |
{ | |
return 'http://www.restoclub.ru'; | |
} | |
public function get_reviews($rest_id = 0) | |
{ | |
if ( ! $rest_id) | |
{ | |
return; | |
} | |
return $this->get('/site/all/main/' . $rest_id . '/opinions/', Apist::filter('.posts_c .post')->each([ | |
'date' => Apist::filter('.post_date')->text()->call(function ($date) | |
{ | |
return strtotime($date); | |
}), | |
'text' => Apist::filter('.post_text')->call(function ($node) | |
{ | |
$text = $node->text(); | |
if ($node->filter('span > span')->count() >= 3) | |
{ | |
$text = str_replace($node->filter('span > span:eq(0)')->text(), '', $text); | |
$text = str_replace($node->filter('span > span:eq(2)')->text(), '', $text); | |
} | |
return $text; | |
}), | |
'attachment' => Apist::filter('.post_text img')->each(Apist::current()->attr('src')), | |
])); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment