Skip to content

Instantly share code, notes, and snippets.

@sleeping-owl
Created January 18, 2015 18:07
Show Gist options
  • Save sleeping-owl/b9b74262159daec99d94 to your computer and use it in GitHub Desktop.
Save sleeping-owl/b9b74262159daec99d94 to your computer and use it in GitHub Desktop.
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