Answer the question
In order to leave comments, you need to log in
Which parser to choose to collect product characteristics from Yandex Market?
Advise a good parser of the characteristics of goods from the Yandex market. It is desirable without the need for finishing and the ability to immediately receive photos of the product. There must be some paid solutions for this task.
Answer the question
In order to leave comments, you need to log in
As a market parser wrote a long time ago, here is a method that searches for self::$partNo on request, although today you can access the Content API , which will undoubtedly be better for use.
protected function YandexMarket (){
$url = 'http://market.yandex.ru/search.xml?text='.urlencode(self::$partNo); // UE40F6400
$simple = file_get_html($url);
$searh = $simple->find('.b-offers_type_guru .b-offers__title a',0)->href;
if (is_null($searh)){return false;}
$title = $simple->find('.b-offers__spec',0)->plaintext;
$simple = file_get_html('http://market.yandex.ru'.$searh);
$name = $simple->find('h1.b-page-title',0)->plaintext;
$category = $simple->find('.b-breadcrumbs__link',0)->plaintext;
$imgBig = array();
$images = $simple->find('span.b-model-pictures__small a');
if (is_null($images)){
$imgBig[] = $simple->find('.b-model-pictures__big a',0)->href;
}else{
$imgBig[] = $simple->find('.b-model-pictures__big a',0)->href;
foreach ($images as $img){
$imgBig[] = $img->href;
}
}
if (is_null($imgBig[0])){
$imgBig[0] = $simple->find('.b-model-pictures__big img',0)->src;
}
$simple = file_get_html('http://market.yandex.ru'.$simple->find('.b-switcher__item a[href^=/model-spec.xml]',0)->href) ; // на страницу с параметрами
if (!($simple->find('.b-properties',0))){return false;}
if (!($simple->find('.b-properties',0)->find('tr'))){return false;}
$description = $simple->find('.b-properties',0)->find('tr');
$descrpt = '';
foreach ($description as $el){
$descrpt .= $el->first_child()->plaintext.'§ '.$el->last_child()->plaintext.'®';
}
$description = $descrpt;
// $simple = file_get_html('http://market.yandex.ru'.$simple->find('.b-switcher__item a[href^=/product/]',0)->href); // на страницу с параметрами
// $posts = $simple->find('.b-aura-reviews');
// $array_post = array();
// foreach($posts as $post){
// $user_post = $post->find('.b-aura-username',0)->plaintext;
// $rating = $post->find('.b-aura-review__rate .b-aura-rating',0)->rate;
// $text = $post->find('.b-aura-review__verdict .b-aura-userverdict');
// foreach ($text as $element){
// if ($element->first_child()->plaintext == 'Достоинства:'){$plus = '<strong>'.$element->first_child()->plaintext.'</strong>'.$element->last_child()->plaintext;}
// if ($element->first_child()->plaintext == 'Недостатки:' ){$minus = '<strong>'.$element->first_child()->plaintext.'</strong>'.$element->last_child()->plaintext;}
// if ($element->first_child()->plaintext == 'Комментарий:'){$commet = '<strong>'.$element->first_child()->plaintext.'</strong>'.$element->last_child()->plaintext;}
// }
// $array_post[] = array(
// 'user' => $user_post ,
// 'rating' => $rating ,
// 'plus' => $plus ,
// 'minus' => $minus ,
// 'comment' => $commet
// );
// }
self::$parser = 'Yandex.Market';
self::$param = array(
'name' => $name ,
'category' => $category ,
'title' => $title ,
'description' => $description ,
'images' => $imgBig
);
return true;
}
I have my own parser. Yandex recently changed the layout, I have already taken this into account. I can put it on github today/tomorrow if needed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question