A
A
Alexey2015-03-01 01:38:26
PHP
Alexey, 2015-03-01 01:38:26

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

4 answer(s)
H
Hazrat Hajikerimov, 2015-03-01
@hazratgs

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;
    }

S
Stepan Yudin, 2015-03-02
@stepan_sib

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

A
Alexey Gorbunov, 2019-09-20
@leha_gorbunov

Like this ymscanner.com ?

A
adminfreeall, 2021-11-16
@adminfreeall

There is also apisystem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question