Parsing Lazada

Discussion in 'Share Experience' started by einstein, Jan 18, 2021.

Tags:
  1. einstein

    einstein A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Jun 27, 2016
    Messages:
    2
    Likes Received:
    0
    Hi,
    I am currently trying to parse Lazada's search results and getting the product detail of the results. I have a template to work with which worked last time but for now it's not fully functional maybe is due to Lazada having some updates and potentially changes. I am trying to adjust the template but I am unsure where it needs to be changed or how to get the info I need. Would appreciate any help that leads me to have a better understanding of using the a-parser itself.

    A few days ago when I am using the template to run the parse, it semi-works as in the result I get are the Url of the products, the position of the product in the search result and location of the product. I would like to get at least the name, price, seller name and delivery fees.


    Here's the template I been working with:

    eJy9V+170zYQ/1eEBiRZUyeBvrCUAqW0o9A2XRMePtRlj2oriYgsGUluG0L/993J
    jp0w2tE9z5YPjnS+159Od+cZdcxO7InhljtLu2czmjJjucH1GT3mrtt9Oxic0CaN
    +ZBl0tHmjF4ymXFgeNJuN9faa+dN6qYpEKi+5MaImAO7iGE/0jre1bC/qaRoxFIX
    jdnqeH3VidSuWgkSBkRYHAsntGKSdmc0GvNosquV48odMZAYeBvtm8paitx2bmxR
    YMngkf4qpGSt9aBN6h+FivWVJccD0mkH7S0ChI21LXK9sdYgO2kq+Ud+8V641vrT
    zeDpBqm/fzs4OmwSKSac/A4WdIPsjo1OeGuzE7SDp+ubz4LfnpE+GzIjCil6KyIZ
    YLvKRt+52LmV/8KAs4DOYjzr7dv1p0ZfTw13RnDrhQwf8Wt48dxGRqTuRRjaX688
    BmEYpODJG+bYdj0MZ8HKyzC8aSDD8zBsFfyg2KvI0aeINjOGTY9ZgvvKkyizTien
    3PokASG/6NIY9Jf7QstQsooHU40KxxP72fOeL7kthZoQw+V2SBW/diElY8OHsDv7
    FNLzFYwAvY9XGt95+h85qtJlB1maApAmU2FYX0KxsYVIwvp/QnAO3vl5Sd4XkhdW
    zh6Rg33yIB5uhSp08ZBsE+DnQ+AIhtokzNXBYbV3/Aae8PpPUmvV4Pkl42YaDIWx
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Cx7FGL6Cn0+46eACNb59B04sXBb7M1/RaMJ0IYvSFNjqahCrh
    4msWwieCdT42qC3v+rnhRBteZKsfyAvfFtCpmmbpjkJ3oB14GErpGdVqR8pDfsll
    5VIJ9M4QBA4KIW9r6XVvUbZzg0YTGPMXu/lc47x5n9F557q6ugok+8piBjUrCZJp
    C7oUk3rUevll+2F+jBBH5OeRXvHxsBzcYhjAcGVEYdKvXveO8o8wqVnMY/QQzzf/
    aCy/I2cLn47d2Q2wf7YnOQ8OOMgBNNBuwRTq+Av6Dawz
     
  2. Support Ilia

    Support Ilia Moderator
    Staff Member A-Parser Enterprise

    Joined:
    Apr 6, 2020
    Messages:
    400
    Likes Received:
    75
    Look like is work fine (I just changed the name of the preset).
    [​IMG]

    Can you show your problem and request?
     
    einstein likes this.
  3. einstein

    einstein A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Jun 27, 2016
    Messages:
    2
    Likes Received:
    0
    The result show:
    3;"";"";"";"Selangor";"";"";"";"";"";"";"https://www.lazada.com.my/products/...mopping-i1099236137-s3072538529.html?search=1"

    There are result that is empty. I am still testing some stuff out so far able to test one that change the result of some positioning but not in the way I wanted with the changes of Result Format:
    upload_2021-1-18_16-54-49.png
    This is what I experimenting with the Result Format code:

    [% maxpages = 5;

    IF !query.query.match('/products/');
    json = tools.parseJSON(p1.itemsjdata);
    pos = query.pos == 'none' || !query.pos ? 1 : query.pos;
    FOREACH item IN json.mods.listItems;
    tools.query.add(item.productUrl.replace('^//', 'https://') _ '@SEP@' _ pos _ '@SEP@' _ item.location);
    tools.query.add(item.productUrl.replace('^//', 'https://') _ '@SEP@' _ pos _ '@SEP@' _ item.price);
    tools.query.add(item.productUrl.replace('^//', 'https://') _ '@SEP@' _ pos _ '@SEP@' _ item.sellerName);
    tools.query.add(item.productUrl.replace('^//', 'https://') _ '@SEP@' _ pos _ '@SEP@' _ item.name);
    tools.query.add(item.productUrl.replace('^//', 'https://') _ '@SEP@' _ pos _ '@SEP@' _ item.review);
    pos = pos + 1;
    END;

    IF p1.np != 'none' && p1.np <= maxpages; #>
    IF query.query.match('page=\d+');
    tools.query.add(query.query.replace('page=\d+', 'page=' _ p1.np) _ '@SEP@' _ pos);
    ELSE;
    tools.query.add(query _ '&page=' _ p1.np _ '@SEP@' _ pos);
    END;
    END;
    ELSE;
    json = tools.parseJSON(p1.jdata);
    data = json.data.root.fields;
    sku = data.skuInfos.0.skuId;

    query.pos _ ';';
    '"' _ (p1.code == 404 ? 'Link not found (404)' : data.product.title.replace('"', '""')) _ '";';
    '"' _ query.loc.replace('"', '""') _ '";';
    '"' _ query.loc.replace('"', '""') _ '";';
    '"' _ query.loc.replace('"', '""') _ '";';
    '"' _ query.loc.replace('"', '""') _ '";';
    '"' _ query.loc.replace('"', '""') _ '";';
    '"' _ query.loc.replace('"', '""') _ '";';
    #'"' _ data.skuInfos.${sku}.price.salePrice.text.replace('"', '""') _ '";';
    #'"' _ data.seller.name.replace('"', '""') _ '";';
    #'"' _ data.deliveryOptions.${sku}.0.fee.replace('"', '""') _ '";';
    #'"' _ data.warranties.${sku}.0.title.replace('"', '""') _ '";';
    #'"' _ data.warranties.${sku}.1.title.replace('"', '""') _ '";';
    #'"' _ data.seller.positiveSellerRating.value _ '";';
    #'"' _ data.seller.shipOnTime.value _ '";';
    #'"' _ data.seller.chatResponsiveRate.value _ '";';
    '"' _ query _ '"' _ "\n";
    END %]

    I would like the result turn out like:
    1;"location";"price";"sellerName";"name";"review";"Url"

    And somehow all of my Threat Log is targeting 1 single link only instead of parsing multiple links
     

Share This Page