Skip to main content

Shop::Ozon::Suggest - Ozon Search Suggestions Scraper

Scraper Overview​

Shop::Ozon::Suggest collects Ozon search bar suggestions: text and type. The search phrase is used as the query.

Collected phrases can be queued again to crawl nested suggestions — use the Parse to level option. Follow suggests selects which types are used in subsequent queries.

You can use automatic query multiplication, substitution of subqueries from files, enumeration of alphanumeric combinations and lists to get as many results as possible. Using result filters, you can clean up results immediately by removing unwanted phrases (negative keywords or a filter by suggestion type).

A-Parser lets you save the parsing settings for the Shop::Ozon::Suggest scraper for future use (presets), schedule scraping, and much more.

Results can be saved in the format and structure you need thanks to the built-in powerful Template Toolkit template engine, which lets you apply additional logic to results and output data in various formats, including JSON, SQL, and CSV.

Collected Data​

  • Number of suggestions ($totalcount)

Suggestions list array ($results):

  • Suggestion text ($results.$i.suggest)
  • Suggestion type ($results.$i.type) — suggest (phrase), category (category), or brand (brand)

what data the Shop::Ozon::Suggest scraper collects

Capabilities​

  • Select the types of suggestions to add to the queue when parsing in depth (Follow suggests: All / Suggest / Category / Brand; multiple selections allowed)
  • Nested collection of suggestions, Parse to level, levels 1–10

Use Cases​

  • Build a database of search phrases from Ozon suggestions

Queries​

Specify search phrases as queries, for example:

socks
sneakers
tank tops and T-shirts

Query Substitutions​

You can use built-in macros to automatically substitute subqueries from files. For example, you may want to add a list of words to each query. In the Keywords.txt file:

discount
promotion
sale

In the query format, specify a substitution macro for additional words from the Keywords.txt file. This method can increase query variation many times over:

$query {subs:Keywords}

This macro creates as many additional queries per original search query as there are entries in the file. The total is [number of original queries] x [number of queries in the Keywords file] = [total number of queries] after the macro runs.

For example, if the original queries are socks, sneakers, and tank tops and T-shirts, and the Keywords.txt file contains the substitutions shown above, the result will be 9 queries:

socks discount
sneakers discount
tank tops and T-shirts discount
socks promotion
sneakers promotion
tank tops and T-shirts promotion
socks sale
sneakers sale
tank tops and T-shirts sale

Result Output Examples​

A-Parser supports flexible result formatting thanks to its built-in Template Toolkit template engine, which lets it output results in any form, including structured formats such as CSV or JSON.

Examples of formats are shown below. The result rows are illustrative: the suggestions for the same query on Ozon may vary.

Default Format​

Result format:

$query: $totalcount
$results.format('$suggest;$type\n')

Example result:

socks: 9
women's socks set;suggest
men's socks;suggest
warm men's socks;suggest
women's socks;suggest
men's socks set;suggest
Men's socks and leg warmers;category
Women's socks;category
KATAYA;brand
Turkan;brand

Exporting a List of Suggestions​

Result format:

$results.format('$suggest\n')

Example result:

women's socks set
men's socks
warm men's socks
women's socks
men's socks set
Men's socks and leg warmers
Women's socks
KATAYA
Turkan

Outputting the Query, Suggestion, and Type​

Result format:

$query:\n$results.format('$suggest - $type\n')

Example result:

socks:
women's socks set - suggest
men's socks - suggest
warm men's socks - suggest
women's socks - suggest
men's socks set - suggest
Men's socks and leg warmers - category
Women's socks - category
KATAYA - brand
Turkan - brand

Outputting a CSV Table​

The built-in $tools.CSVLine utility lets you create properly formatted table documents ready for import into Excel or Google Sheets.

Result format:

[% FOREACH i IN results;
tools.CSVline(i.suggest, i.type);
END %]

File name:

$datefile.format().csv

Initial text:

Suggestion,Type

Example result:

Suggestion,Type
women's socks set,suggest
men's socks,suggest
warm men's socks,suggest
women's socks,suggest
men's socks set,suggest
Men's socks and leg warmers,category
Women's socks,category
KATAYA,brand
Turkan,brand
tip

The result format uses the Template Toolkit template engine to output $results array elements in a FOREACH loop.

To save results to a file, simply change the file extension to csv.

To make the "Prepend text" option available in the Task Editor, activate "More options". In "Prepend text", enter the column names separated by commas, then leave the second line blank.

Saving in SQL Format​

Result format:

[% FOREACH results;
"INSERT INTO serp VALUES('" _ query _ "', '" _ suggest _ "', '" _ type _ "')\n";
END %]

Example result:

INSERT INTO serp VALUES('socks', 'women's socks set', 'suggest')
INSERT INTO serp VALUES('socks', 'men's socks', 'suggest')
INSERT INTO serp VALUES('socks', 'warm men's socks', 'suggest')
INSERT INTO serp VALUES('socks', 'women's socks', 'suggest')
INSERT INTO serp VALUES('socks', 'men's socks set', 'suggest')
INSERT INTO serp VALUES('socks', 'Men's socks and leg warmers', 'category')
INSERT INTO serp VALUES('socks', 'Women's socks', 'category')
INSERT INTO serp VALUES('socks', 'KATAYA', 'brand')
INSERT INTO serp VALUES('socks', 'Turkan', 'brand')

Dumping Results to JSON​

General result format:

[% result.${query} = {
totalcount = p1.totalcount
suggests = []
};

FOREACH i IN p1.results;
item = {};
item.suggest = i.suggest;
item.type = i.type;
result.${query}.suggests.push(item);
END %]

Initial text:

[% result = {} %]

Final text:

[% result.json %]

Example result:

{
"socks": {
"totalcount": 9,
"suggests": [
{ "suggest": "women's socks set", "type": "suggest" },
{ "suggest": "men's socks", "type": "suggest" },
{ "suggest": "warm men's socks", "type": "suggest" },
{ "suggest": "women's socks", "type": "suggest" },
{ "suggest": "men's socks set", "type": "suggest" },
{ "suggest": "Men's socks and leg warmers", "type": "category" },
{ "suggest": "Women's socks", "type": "category" },
{ "suggest": "KATAYA", "type": "brand" },
{ "suggest": "Turkan", "type": "brand" }
]
}
}
tip

To make the "Prepend text" and "Append text" options available in the Task Editor, activate "More options".

Results Processing​

A-Parser can process results during scraping. For Shop::Ozon::Suggest, this means nested crawling of suggestions.

Parse to level option (Parse to level)​

By default, the scraper does not add suggestions to the queue. In Parse to level, select a level from 1 to 10:

  • level 1 — suggestions from the original query are added to the queue;
  • level 2 — suggestions collected from level 1 queries are added as well;
  • and so on, up to the selected level.

Suggestion text is added to the queue. The same text from a single response is not added a second time. Follow suggests determines which types to queue; All includes all types.

Results will likely contain duplicates, so enable query deduplication (Unique queries); otherwise, the scraper will crawl the same phrases again.

Possible Settings​

ParameterDefault valueDescription
Follow suggestsAllWhich suggestion types to add to the queue when Parse to level is enabled: All, Suggest, Category, Brand. Multiple selections are allowed
Max concurrent browser pages10How many Chrome tabs the scraper can keep open at once. A higher value increases memory and CPU usage
Chrome Headless☑When enabled, the Chrome window is hidden
Use session☑Saves the session and uses it in subsequent queries