-
Join our Telegram chat: https://t.me/a_parser_enDismiss Notice
Formatting of results
-
In A-Parser is applied to formatting of results Template Toolkit, that allows to save easily results of parsing in different formats:
- In text files by list: one result for the line, through a separator, in arbitrary format
- In the CSV files with possibility of further import to Excel, Google Docs, etc.
- In XML, JSON and other data storage formats
- In HTML on the fly generating pages
- In the SQL dumpings format for direct import to database
- In a binary format for saving of images (jpg, png, gif, ...), documents (pdf, docx, ...), executable files and archives (exe, dmg, zip, ...) and any other data types
Editing format of result(top)
Result format - allows to format results to the necessary look using templates, the request results is applied to each combination
- General format of result is set in the field Result format
- Result format for each parser separately can be set in settings of a parser in Result format
- $p1 - results from the first parser (
SE::Google on a screenshot), $p2 - results from the second parser (
SE::Bing on a screenshot)
- Sequence number of a parser is displayed to the left of a parser choice field
- of $p1.preset and $p2.preset implies that it is necessary to take value format of result from settings of the appropriate parsers
- In this example $p1.preset can replace with $p1.serp.format ('$link\n') that will have identical effect, thus the result format from settings won't be used any more
Result format can be specified in a convenient multiline editor having clicked the appropriate icon in the field of editing:
In the general format of results the following variable is available :
- $query - request after formatting
- $query.* - all variables relating to request are described in article Шаблоны в запросах
- $p1, $p2, ... - variables for access to results of parsing for each parser separately
- of $p1.query, $p2.query... - requests after formatting taking into account a request format each parser specified in settings
Prepend and append text(top)
For each result file, a separate Append/Prepend text:
- For formation of CSV cap of the file
- For beginning and finite tags of the XML file
- For a header, a cap and a footer of HTML files
- For any other options of application
in the lower part of theTask editor
In the initial and finite text use of a shablonizator of Template Toolkit, available variables is supported:
- $query - request after formatting
- $query.* - all variables relating to request are described in article Шаблоны в запросах
Format your results file name(top)
A-Parser allows to use templates also in names of result files, that allows to create automatically files and folders on the basis of current date, on sequence number of request, on the request and in any other format
In the field File name are supported the following variables:
- All variables available to the General format of result
- $queriesfile - path and file name with queries, if requests are specified through the form that will contain queries_from_text.txt
- $datefile - the object date plug-in of Template Toolkit which is set up on a format date %b-%d _%H-%M-%S, when formatting gives out the current time and date in look May-08_20-08-38, change format is possible in Advansed settings
Complex exampleCode:reports/$queriesfile/${query}.txt
- Reports folder will be created
- Subfolder with file name of requests Will be created
- In subfolder will be created so many files, how many requests is used in task, as file name will be used the request with extension .txt